Class LinearSearcher

java.lang.Object
  extended by LinearSearcher

public class LinearSearcher
extends java.lang.Object

Searches an array using linear search

Version:
July 2005
Author:
Todd A. Whittaker

Constructor Summary
LinearSearcher()
           
 
Method Summary
 int search(int[] array, int target, int left, int right)
          Searches a subset of an array 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

LinearSearcher

public LinearSearcher()
Method Detail

search

public int search(int[] array,
                  int target,
                  int left,
                  int right)
Searches a subset of an array 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.