2

I am a newbie to data structures, and I was trying to learn threaded binary tree. My question is: after a tree has been threaded and if I need to add some nodes to the tree, should I un-thread it before adding nodes and then thread it again, or are there some better ways to add new nodes to a threaded binary tree? Please help me.

1 Answer 1

3

You don't want to unthread the whole tree, because that takes O(n) operations in the number of nodes.

Instead, just correct the pointers in the nodes you "touch".

Here's a tutorial that might help.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.