Traversing techniques of a binary tree - Pre-order, in-order, post-order

Q.  There are different ways of traversing a binary tree. What are those traversing technique?
- Published on 22 Jun 15

a. Prefix, infix, postfix
b. Pre-order, in-order, post-order
c. Pre-traversal, in-traversal, post-traversal
d. None of the above.

ANSWER: Pre-order, in-order, post-order
 

    Discussion

  • Nihal   -Posted on 01 Apr 16
    There are three standard traversal techniques in binary tree. These techniques are as follows.
    Pre-order, in-order, post-order.

    Preorder Traversal:
    • Visit the root node in binary tree.
    • Traverse the left subtree of root in preorder.
    • Traverse the right subtree of root in preorder.
    Postorder Traversal:
    • Traverse the left subtree of root in postorder.
    • Traverse the right subtree of root in postorder.
    • Visit the root node in binary tree.
    Inorder Traversal:
    • Traverse the left subtree of root in inorder.
    • Visit the root node in binary tree.
    • Traverse the rightsubtree of root in inorder.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)