You are viewing a single comment's thread. Return to all comments →
Python solution:
def preOrder(root): def recursion(root, results): if root is None: # base case: empty subtree return results.append(root.info) recursion(root.left, results) recursion(root.right, results) results = [] recursion(root, results) print(" ".join(map(str, results)))
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Preorder Traversal
You are viewing a single comment's thread. Return to all comments →
Python solution: