Tree: Preorder Traversal

  • + 0 comments

    This is one possible solution in python

    def preOrder(root):
        if root:
            print(root, end=' ')
            preOrder(root.left)
            preOrder(root.right)