Archived

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

Lestat3D

Binary/n-ary trees

Recommended Posts

Lestat3D    122
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
ZubZorro    122
Hi.

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