Created
January 2, 2017 00:23
-
-
Save liondancer/7a305b41baa048a5b86c5a2ab83197eb to your computer and use it in GitHub Desktop.
Binary Tree Inorder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binary_tree_inorder(root): | |
res = [] | |
if root: | |
helper(root, res) | |
return res | |
def helper(root, res): | |
if root: | |
helper(root.left, res) | |
res.appned(root.val) | |
helper(root.right, res) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
why "if root" again in helper function?