binary tree example in python
Example: traversing a tree in python
"""Post-order"""
def postorder_traversal(self, root):
res = []
if root:
res = self.predorder_traversal(root.left)
res = res + self.predorder_traversal(root.right)
res.append(root.data)
return res