Bug fixes to C code.

This commit is contained in:
krahets
2023-11-01 05:14:22 +08:00
parent f7dd05e7a4
commit 355cc3a6b1
31 changed files with 246 additions and 219 deletions

View File

@@ -42,7 +42,7 @@ void printLinkedList(ListNode? head) {
* This tree printer is borrowed from TECHIE DELIGHT
* https://www.techiedelight.com/c-program-print-binary-tree/
*/
void printTree(TreeNode? root, [Trunk? prev = null, bool isLeft = false]) {
void printTree(TreeNode? root, [Trunk? prev = null, bool isRight = false]) {
if (root == null) {
return;
}
@@ -54,7 +54,7 @@ void printTree(TreeNode? root, [Trunk? prev = null, bool isLeft = false]) {
if (prev == null) {
trunk.str = '———';
} else if (isLeft) {
} else if (isRight) {
trunk.str = '/———';
prev_str = ' |';
} else {