Jump to content
  • Advertisement


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


Binary/n-ary trees

This topic is 6098 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

Are there any system function or standarized function that let me make a binary/n-ary tree and keep it balanced? If there are someone, where could I find it?

Share this post

Link to post
Share on other sites

std::set and std::map
are associative containers, which must guarantee a maximum lookup time of O(lg n).

Now, the only way to ensure that is to use some kind of search tree.

So for what people say, most map implementations are red-black trees... red black trees is binary trees which also must satisfy the 4 Red-black properties all the time.
When the properties are satisfied, the tree will stay balanced.

So that was a bit OT, but what you need is set & map

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!