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
you are probably using binary search trees.
In C++ for instance, you have the
std::mapandstd::hash_maptypes. The first one is coded as a binary tree withO(log(n))insertion and lookup, whereas the second one is coded as a hash map (withO(1)lookup time).EDIT: I just found this answer. You should take a look at it.