Class SearchMethods

java.lang.Object
  extended by SearchMethods

public class SearchMethods
extends Object

A class that demonstrates search algorithms

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
SearchMethods()
           
 
Method Summary
static String find(String target, String[] strArray)
          Implement a simple binary search through the array of strings
static String lfind(String target, String[] strArray)
          Implement a linear search through the array of strings
static void main(String[] args)
          main for testing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchMethods

public SearchMethods()
Method Detail

lfind

public static String lfind(String target,
                           String[] strArray)
Implement a linear search through the array of strings

Parameters:
target - the string to look for
strArray - the array of strings to look in

find

public static String find(String target,
                          String[] strArray)
Implement a simple binary search through the array of strings

Parameters:
target - the string to look for
strArray - the array of strings to look in

main

public static void main(String[] args)
main for testing