Wednesday, October 24, 2012

Java Exercise #32: Binary Search

Java JDK provides Binary Search. This program is to implement such a binary search.

Exercise: Write an implementation of binary search and test as below.


List is : [2, 4, 7, 10, 11, 45, 50, 59, 60, 66, 69, 70, 79 ]
Binary Search of 2: 0
Binary Search of 11: 4
Binary Search of 12: -6
Binary Search of 1: -1
Binary Search of 3: -2


Download Code: Binary Search

No comments:

Post a Comment