Post Order Traversal In Binary Tree

Post Order Traversal In Binary Tree

  1. Its LRN ordered traversal.
  2. The order goes this way:
    1. L: Traverse the left sub tree.
    2. R: Traverse the right sub tree.
    3. N: visit the node
  3. Lets check with an example. Consider the following example.
      • Traverse the left sub tree of node 1
        • Traverse the left sub tree of node 2
          • Visit the node 4
        • Traverse the right sub tree of node 2
          • Visit the node 5
        • Visit the node 2
      • Traverse the right sub tree of node 1
        • Traverse the left subtree of node 3
          • Visit the node 6
        • Traverse the right sub tree of node 3
          • Visit the node 7
        • Visit the node 3
      • Visit the node 1
    1. On completing the traversal we get the post order if we follow the bolded nodes.
    2. Post Order: 4 , 5 , 2 , 6 , 7 , 3 , 1

Comments

Popular

Traversal In A Binary Tree - Tree -3

Tree data structure - 2

Pre Order Traversal In Binary Tree