Post Order Binary Tree Traverse

Design a conventional iterative algorithm to traverse a binary tree represented in two dimensional array in postorder.

Questions by Dheerendra_juli

Showing Answers 1 - 2 of 2 Answers

In Postorder traversal sequence we first look for the left node then the right node and then the root.

  1. void postOrder(tNode n)

  2. {

  3.  if(n==null)

  4.     return;

  5.     postOrder(n.left);

  6.    postOrder(n.right);

  7.     visit(n);

  8. }

  Was this answer useful?  Yes

Shikhar Singhal

  • Jun 10th, 2013

When tree is implemented using linked list rather than 2-d array

  1. void traverse(tree head)

  2. {

  3. if (head.left!=NULL)    traverse( head.left);

  4. if (head.right!=NULL)    traverse(head.right);

  5. printf("%d",&head);

  6. }

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions