Constructing a Binary Search Tree..

Are there easy and efficient method to construct a binary tree without using structures or pointers?

How can we use STL to construct a binary search tree, as suppose we have given an array with n numbers, where n is about 10000, just example, so how can we construct a binary search tree without using pointers or structures to find a number…?

Add the numbers to a STL set object.

1 Like

If you’re using C++, std::set is what you’re looking for. Basically it is a RB tree. Here you can have more info.

1 Like

Thanks for reply…

Actually i do not have any idea about trees!!

So could you please explain and show me an implementation.?

I know the theory and the concept but not the implmentation…

Please Help!!

Thanks for answer… but could you show me an implemented code?

You can see examples in the cplusplus website. E.g. this one for inserting - http://www.cplusplus.com/reference/set/set/insert/ and find for searching http://www.cplusplus.com/reference/set/set/find/

Thank You @mogers:slight_smile: