You are viewing a single comment's thread. Return to all comments →
def preOrder(root): stack = [root] while stack: curr_node = stack.pop() print(curr_node.info, end=' ') if curr_node.right: stack.append(curr_node.right) if curr_node.left: stack.append(curr_node.left)
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 →