Class BinarySearcher

java.lang.Object
  extended by BinarySearcher

public class BinarySearcher
extends java.lang.Object

Searches an array using binary search

Version:
July 2005
Author:
Todd A. Whittaker

Constructor Summary
BinarySearcher()
           
 
Method Summary
 int search(int[] array, int value, int left, int right)
          Searches a subset of an array using binary search for the value between the given left and right indices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinarySearcher

public BinarySearcher()
Method Detail

search

public int search(int[] array,
                  int value,
                  int left,
                  int right)
Searches a subset of an array using binary search for the value between the given left and right indices.

Parameters:
array - the array to search
value - the target value to find
Returns:
the index (left <= index < right) where the element was found, or a negative number when not found.