You are viewing a single comment's thread. Return to all comments →
Here a Python Iterative:
def postOrder(root): res = [] q = [root] visited = [False] while q: node = q.pop() v = visited.pop() if node: if v: res.append(node) else: q.append(node.info) visited.append(True) q.append(node.right) visited.append(False) q.append(node.left) visited.append(False) print(*res)
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Postorder Traversal
You are viewing a single comment's thread. Return to all comments →
Here a Python Iterative: