Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Query about trees.

This topic is 5779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Let's say you have a binary (for simplicity's sake) tree, and you want to insert an item of data that is identical to an item that is already in the tree. Is it common practice to insert it into the left-hand branch (less than) or the right-hand branch (greater than) of the identical node that is already there? I was wondering if there was a convention for this because although I have not tried it, (I treat indentical values the same as less-than values at the moment) I would imagine it would make a difference when traversing the tree in pre or post-order. I would think that it wouldn't matter with in-order traversal. Cheers for any insights. - CheeseMonger Edit: Sorry if it's already been discussed, the search is temporarily(!!) down. [edited by - CheeseMonger on January 23, 2003 3:36:58 PM]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Binary search tree
1. All items in left subtree are less than the root
2. All items in the right subtree are greter than or equal to the root
3. Each subtree is itself a binary search tree.

that clear it up?

Share this post

Link to post
Share on other sites
Cheers, that's great, I just didn't know which side to put the equals on, my lecturers only glossed over trees vaguely at uni... and I'm a second year CS student! I just decided to see if I could (successfully, I might add) make one...

- CheeseMonger

[edited by - CheeseMonger on January 23, 2003 4:33:46 PM]

[edited by - CheeseMonger on January 23, 2003 4:35:15 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!