use of the binary search tree in real-world programs?

advertisements

Possible Duplicate:
Where is binary search used in practice?
What are the applications of binary trees?

I have done various exercises involving adding,deleting,ordering and so on.

However i am having a hard time visualizing the use of binary search tree in real world programs. I mean sure it is way faster than some of the other algorithms for searching. But is this its only use ?

Could you give me some examples of this algorithm use in real world software.


Whenever you use maps (or dictionaries) you are using binary search trees. This means that when you need to store arrays that look like

myArray["not_an_integer"] = 42;

you are probably using binary search trees.

In C++ for instance, you have the std::map and std::hash_map types. The first one is coded as a binary tree with O(log(n)) insertion and lookup, whereas the second one is coded as a hash map (with O(1) lookup time).

EDIT: I just found this answer. You should take a look at it.