Search - /* / Search.java / / Implementation of a simple...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Search.java // // Implementation of a simple recursive search //******************************************************************** / import java.io.IOException; import java.util.Scanner; import java.util.ArrayList; i public class Search { //---------------------------------------------------------------- // Number of comparisons made in the last search //---------------------------------------------------------------- private int comparisons = 0; //---------------------------------------------------------------- // Performs a recursive search of the list of Strings, returning // true if the given String is found in the array between the two // given indices. //---------------------------------------------------------------- public boolean search( String str, String[] list, int startIdx, int endIdx) { boolean result = false; b // If our startIdx is after our endIdx, then we've determined // that the string cannot be in the list. if (startIdx <= endIdx) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Search - /* / Search.java / / Implementation of a simple...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online