Question

Describe a binary tree T for which the pre-order and post-order traversals result in precisely the...

Describe a binary tree T for which the pre-order and post-order traversals result in precisely the same ordering of T’s nodes. (That is, pre-order-traverse(T) = post-order-traverse(T).)

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

The only binary tree for which the pre-order and post-order are the same is a binary tree which only contains the root node. Thus, the binary tree looks like this:

There are no children to the root node, it is precisely the only node in the tree.

To see why this is the only tree for which pre-order and post-order is the same, argue as follows. Let there be a child of the root node. When running pre-order traversal, the root node will be visited first and then its children will be traversed. In post-order, the children will be traversed first and then the root node. Therefore, if there is a child of the root, then the pre-order and post-order traversal have to be different.

Comment in case of any doubts.

Add a comment
Know the answer?
Add Answer to:
Describe a binary tree T for which the pre-order and post-order traversals result in precisely the...
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