Allan Didier

Binary Search

Goals

Write a program to search through an array of Strings using the Binary Search algorithm.

Skills

Program Details

Create a program that uses the Binary search to find name in an array of Strings.  You can use the array of names (or words) from the Selection Sort algorithm. Description of the search techniques can be found in the Java book, Chapter 10.5, page 513 or on the Binary Search page.

Your program needs the following:

  1. Main Program
    1. Instantiates the array of names (or words).
    2. Sorts the array using whatever sorting algorithm you want.
    3. Asks the user to input a name to search for.
    4. Runs a binary search for the user requested name.
    5. Outputs whether or not the name was found.

Resources

Edhesive Term 2

Edhesive T2 Lesson 17: Binary Search

AP College Board Video: Binary Search

Geeks for Geeks: text explanation