tree traversal algorithms python code example
Example: traversing a tree in python
"""Inorder Traversing"""
def inorder_traversing(self, root):
res = []
if root:
res = self.inorder_traversing(root.left)
res.append(root.data)
res = res + inorder_traversing(root.right)
return res