Computer Science 1320

Laboratory Assignment Seven

Spring Semester 2010

 

Sorting Revisited

 

For this laboratory assignment we shall modify our sorting algorithms so they will sort words.

 

Given a large body of text, we wish to read the words into an array of words (a two dimensional array of characters). We then wish to sort the words into alphabetic order, and write the sorted list of words to a second file.

 

Once we have the list of words in an array, we wish to examine the array and determine the number of one letter words, the number of two letter words, the number of three letter words, etc.

 

In order to perform the above count, we need an integer counter array. This array must be able to count no matter what word lengths may be involved. Thus, we will search the word array and determine the longest word. We will then use malloc to allocate a counter array of exactly the right size to hold the word counts.

 

Finally, prompt the user to enter a word. Use the binary search to search your sorted word list and report whether or not it is in the list. Your binary search should return the position of the word in the list if found, or -1 if not found. Also, report the number of comparisons required to find whether or not the word is in the list.

 

Display all information for the user as the program terminates.

 

 

Paper hand-in is still required as before.

 

Program due date: April 12, 2010