5

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.

Community
  • 1
  • 1
Win Coder
  • 6,628
  • 11
  • 54
  • 81

2 Answers2

3

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.

Community
  • 1
  • 1
alestanis
  • 21,519
  • 4
  • 48
  • 67
1

Binary Space Partition is required in computer graphics. This uses Binary Search. More details are available at: http://en.wikipedia.org/wiki/Binary_space_partitioning

Manas Paldhe
  • 766
  • 1
  • 10
  • 32