Algorithm
Development Kit 1.0

algs.model.search
Class BinarySearch<T extends java.lang.Comparable<T>>

java.lang.Object
  extended by algs.model.search.BinarySearch<T>

public class BinarySearch<T extends java.lang.Comparable<T>>
extends java.lang.Object

Binary Search in Java given a pre-sorted array of the parameterized type.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Constructor Summary
BinarySearch()
           
 
Method Summary
 boolean search(T[] collection, T target)
          Search for target in collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinarySearch

public BinarySearch()
Method Detail

search

public boolean search(T[] collection,
                      T target)
Search for target in collection. Return true on success.


Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.