Question

7 Perform a preorder, inorder, and postorder traversal of the tree displayed below.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. Preorder Traversal-

Algorithm-

  1. Visit the root
  2. Traverse the left sub tree i.e. call Preorder (left sub tree)
  3. Traverse the right sub tree i.e. call Preorder (right sub tree)

RootLeftRight

preorder - a b f e c g h i d j a

2. Inorder Traversal-

Algorithm-

  1. Traverse the left sub tree i.e. call Inorder (left sub tree)
  2. Visit the root
  3. Traverse the right sub tree i.e. call Inorder (right sub tree)

LeftRootRight

Inorder - f b e g c a h d i j

3. Postorder Traversal-

Algorithm-

  1. Traverse the left sub tree i.e. call Postorder (left sub tree)
  2. Traverse the right sub tree i.e. call Postorder (right sub tree)
  3. Visit the root

LeftRightRoot

Postorder - f e b g i h c j d a

Add a comment
Know the answer?
Add Answer to:
7 Perform a preorder, inorder, and postorder traversal of the tree displayed below.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT