This is what I got for the in-order of the bst but it's wrong because I'm answering some questions about some successors of some of the letters and I got them wrong. so I'm wondering where in this in-order i've gone wrong? enter image description here

d, b, m, h, i, e, a, j, k, f, g, c

(Sorry if these questions aren't allowed here, please let me know where I can ask it if not!)


Remember that an in-order traversal lists the elements from left-to-right, descending the tree: Left, Root, and Right. This means that starting from the root (a), we will traverse the whole left branch, then print a, and finally traverse the right branch.

You started off correct; however, your mistake was that you put m beforee h. It is an easy mistake to make so you have to be careful. The m node is the right node of h so the traversal for that subtree will be h, m. The same goes for i and e in your traveral---they should be flipped.

The correct answer for this in-order traversal is d b h m e i a j f k c g.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.