I'm having a small problem. I've created a binary tree that represents an n-ary tree using the left-child and right sibling syntax. I know that preorder on the binary tree gives you the same result as if the tree weren't binary. But, how do you change postorder and levelorder so that you don't ruin the order that the n-ary tree would have given you?
Jump to Post
You differentiate between logical and actual links. Logical links are part of an n-ary node, but represented with actual binary links. If you can do that, you will be able to figure out how to move when doing any traversal. Red black trees do this well, if you need a …
All 2 RepliesReply to this topic
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.