Tuesday, 4 December 2012

Binary Search


  Binary Search is used to find a key number from a list of numbers. The time complexity of the algorithm is O(nlog n). The advantage is the shorter time requirement and the disadvantage is that Linear Search works only with a sorted list of numbers. So Linear Search is a not a general search algorithm which can be applied on any list.

Advantages:
  •  The Algorithm takes only O(n log n) time for finding the item.
Disadvantages:
  • Gives the correct output only if the array of numbers is sorted.

Click here to download the C Program to perform Binary Search.
Click here to download the C++ Program to perform Binary Search.

No comments:

Post a Comment