CSCI 151 - Data Structures and Object-Oriented Development
Spring 2015
Lab 10: Word Counts, part 1: Insertion sort and binary search
- For the next several labs, we will explore different algorithms and data
structures for solving the word counting problem:
- Given a document, how many times does each word in the document appear?
- For this lab, we will employ the following algorithms and data structure:
- Each word and its count will be stored in a sorted array.
- When each new word is added, it is inserted into the array in sorted
order.
- When an existing word's count is increased or retrieved, it is found
using binary search.
- As an interesting test case, we will use Herman Melville's classic novel
Moby Dick.
- Download the provided code.
- The code for these labs will be incorporated into the editor project.
- The code includes the following files:
- Once your solution is working, run
TimeTest to compare its
performance with the unsorted version provided.
Grading
For an A+, pass all unit tests. Also, provide the timing information gleaned
from TimeTest via Moodle when submitting. The performance of the sorted
array should be clearly superior to that of the unsorted array.
Without this, the grade is as follows:
| Number of Unit Tests Passed | Grade |
| 6 | B |
| 4 | C |
| 3 | D |