mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-27 20:11:01 +08:00
Bug fixes to C code.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user