Jump to content
xisto Community
Sign in to follow this  
varalu

Data Structure -- Trees -- Threaded Binary Tree

Recommended Posts

A binary tree having a loop is known as a threaded binary tree.Have a look at the attachment to have an idea of a threaded binary tree....A's right child is B and B's left child is A.Write an algorithm to find out whether the given tree is a threaded binary tree.post-50968-1195554505_thumb.jpgLook for time and space complexity.

Share this post


Link to post
Share on other sites
Adding Elements to a threaded binary treeData Structure -- Trees -- Threaded Binary Tree

Using the most efficient way I muss add  50.000 elements in a tree.The key nodes are integers between [-50.000.000 to 5.000.000]. No deleting operation is needed

I need to write a little java code about this but don't get the idea well, so need so tips

thnks guys!

-question by Mubo

 

Share this post


Link to post
Share on other sites

You wont believe it, but your teachers from uni read forums as well... So maybe you want to look into informatik-forum.At... But to answer your question:

Look up the insert-method in regular Binary Trees (p 75) and think about how to modify it so it works with threadedBinaryTrees. You'd probably want to think about getting the parent of a node without using a stack or a parent-var. For that I can recommend Depth-First Search, since in a TBT some of the node's child-thread points back to the original nodes parent.

Hope that was a little helpfull

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.