CSC 273-Data Structures
Dr. R. M. Siegfried
Assignment #1 - A Concordance Program
Due Friday, September 20, 2019
A concordance is a table that tells how often a word appears in a text (or
where in a text it appears; but we are not using this definition).
You are going to write a program for a concordance that:
- reads a text
- separates it into words (any collection of letters appearing between
non-alphabetic characters)
- places them into a table (if they are not already there with an initial
count of 1)
- or adds one to its count in the table (if it's already there).
The next step in writing this program is to write the Concordance class with:
- the necessary constructor that
initializes the number of installed words to zero (0)
- Installs additional words, by placing them at the end of the array,
incrementing the count and then sorting them into order.:
- searches the array for a word, returning the index if the word is there
and return -1 if it isn't
- Prints the lsit of words and the number of occurences in the text.
Your program should be modular, with separate classes for handling input/output
and for the concordance.
To simplify the assignment, assume that a word is any collection of
consecutive characters separated by white space.
Your input should be a text file (or equivalent) and your output should
be a listing of the words (in alphabetical order) and the number of times
that they appear in the input.
You will submit a program listing (properly commented), your sample
document (at least 40 lines of text) and the print-out.
[Back to the Assignments Page]