Lab 10

Binary Search

March 31, 2005

Lab Partners

Everyone should work with one lab partner on this assignment.

Purpose

There are two purposes of this in-lab. The first purpose is to help you better understand binary search. The second purpose is to help you better understand recursion.

Before Lab Begins

Create a BlueJ project named inlab10 and add Wednesday's lecture files to it:

Iterative Implementation of Binary Search - 4 points

Implement the binarySearch method.

Recursive Implementation of Binary Search - 4 points

Implement the binarySearchRecursive method.

Empirical Investigation - 2 points

Conduct and document an empirical investigation that shows that the average case of a successful linear search is O(n) and that the average case of an unsuccessful binary search is O(log n).

What to Submit

Before the end of the lab period, send an e-mail to Mike with your modified Search.java file and your empirical investigation document. Mike's e-mail is mthiesen@gmail.com. The subject of the message should be: CS221-xx inlab10 your-names. The xx is the number of your lab section.

Before Lab Ends

Delete any BlueJ projects that you created and empty the recycle bin. Thanks.