COSC 1436 Lab 8

Purpose: This lab is designed to allow you to search two large list of words, one sorted and one unsorted. You will be writing a linear search to sort the unsorted words and a binary search to search the sorted data. You will then pass in words for your program to find. You will then search for the word using both methods and tell me how many compares and how much time were needed to find each word.

Due: Section 2: Before class on March 26, Section 3: Before class on March 28


1. Create two programs that search lists of words. Both lists are identical, except for the sort order, and each contain 60000 words. Treat the first list as if it is unsorted, even though it is sorted by word size. Use the linear search program given in the class/text to search the unsorted list. Use the binary search to search the sorted list. Both programs will be fed by the same list of words to search for. Some of the words are in the list, some are not. Both programs must include the following:

The first program uses a linear search to search an unsorted list of words. The input file is words60K.txt.

The second program uses the sorted list of words and uses the binary search. The input file is wordsSorted60K.txt

2. Prepare a lab report/documentation package. All of these items do not need to be in the same file or word document, but the main lab report file must reference each item by name. The lab report must includes the following information:

3. Code the entire program based upon your pseudocode/flowchart. The program should include extensive comments. Save the program as lab08XXX.cpp. Your program must compile and run properly in the Linux environment ( Compile and run this program and make sure it provides the proper output.

4. You will be submitting this lab via Blackboard. You will need to zip your files together and then upload your zipped submission to Blackboard. Make sure you include the source code and the rest of the documentation package, but not the executable files. The source code for your programs, called lab08***.cpp. Put your initials where the 3 asterisks appear. This files must be ready to compile using the standard g++ compiler.

Grading Criteria: 100 points available for this lab.
  • The lab grader will be using this grading criteria to grade your two programs. The points will then be scaled to the available points.
  • Here is a C++ style guide from Dr. Fernandez that should assist you in coding your program. Style guide.
  • 100 points if all of the above requirements are met.