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

@@ -71,7 +71,7 @@ func PrintTree(root *TreeNode) {
// printTreeHelper Help to print a binary tree, hide more details
// This tree printer is borrowed from TECHIE DELIGHT
// https://www.techiedelight.com/c-program-print-binary-tree/
func printTreeHelper(root *TreeNode, prev *trunk, isLeft bool) {
func printTreeHelper(root *TreeNode, prev *trunk, isRight bool) {
if root == nil {
return
}
@@ -80,7 +80,7 @@ func printTreeHelper(root *TreeNode, prev *trunk, isLeft bool) {
printTreeHelper(root.Right, trunk, true)
if prev == nil {
trunk.str = "———"
} else if isLeft {
} else if isRight {
trunk.str = "/———"
prevStr = " |"
} else {