Binary Search and Correctness
Due: Feb 27, 2012
Presentation By: XXX and YYY
Your mission for Homework #5 is to implement a binary search. However, in this problem, your sorted data is on disk. For Example, you might create data that looks like the following:
005 NY Mid-Island.... 006 PR San Juan...... 007 PR San Juan...... 008 VI Virgin Islands 009 PR San Juan...... ... 995 AK Anchorage..... 996 AK Anchorage..... 997 AK Fairbanks..... 998 AK Juneau........ 999 AK Ketchikan.....
Notice that each dot on the end of a line is a space. That makes it so that each line is exactly the same length.
You goal is to write a function that given a item to look up (say "467") you will perform a binary search on this data to either find the row, or report that no such data exist. DO NOT READ THE WHOLE DATA FILE INTO MEMORY!
You will need:
What to hand in