Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #traversing #tree #python
ADD COMMENT
Topic
Name
7+5 =