Instructions for Machine Problem #3 -- COM1201 Sp2000 -- Professor Futrelle
Here are the source code samples I demonstrated in class and posted the next day,
Friday the 26th of May:
A progress report is due on the Thursday, May 25th
and the full machine problem is due on Thursday
June 1st -- the last day of class.
1/3 of the MP#3 grade will be based on the Progress Report.
The goal of this machine problem can be simply stated: Build a hash table and hash function
and show that you can insert and find values in the table, using a key.
This is a team project. You should work in groups of two, or possibly three students. When
you hand in the progress report and the final results, you must include a statement signed
by the two or three students involved as to what the division of labor was -- who did what
and how much of each part of the work was done by each team member. The problem can
be done on any platform you choose, Windows, Mac, Unix, Linux, etc.,
but the final project must be handed in on floppies that you have checked so that
you know it runs on the College Windows NT systems, as a simple console application (see
the instructions for such applications in connection with Lab #2.)
The general goals are for you to:
- Understand hashing, both hash functions and hash table structure and operations.
- Use the separate chaining algorithm/data-structure, with lists "hanging off of" array elements.
- Get experience working on a team project.
- Learn how to work from an API (commented declarations) to build an application.
- Decompose a project into appropriate files -- declarations, definitions and the client (main).
- Organize your project so that the code and results are clear and clearly explained.
More specifically, you should proceed in the following way:
- Design and implement a simple hash table class.
Use an integer key and a string value.
- Design and test a simple hash method function for integer keys.
- Design a simple linked list class structure and test it.
- Create a function that prints a list node and then one that prints a list.
- Manually attach a node to a hash array item, then a list.
- Design and test a function that prints out the hash table, printing out each list.
- Design and test an insert function that hashes the key, builds the node and inserts it.
- Insert a number of values and print the hash table to show that things are there.
- Print out the number of elements attached to each hash array element.
- Design and test a search function that returns a value if the value is in the table.
- Optional: Use a string as the key and a string or integer as the value.
- Optional: Read data from and print results to files so you can use larger data sets,
such as file countryCodes.dat.
- Optional: Design a function that clears the hash table, deleting the list nodes.
- Comment your code. Some comments should be grouped before a class or function, others
might be at the detailed code level. Please don't put one comment for every line of code.
Use better judgement than that.
- Work on the documentation of your project, which should include what you did, how you did it,
what your results were, and most importantly a discussion of your results, and conclusions.
Results don't "speak for themselves"; they must be explained to be worth anything.
- For the details on what to hand in, in the way of floppies, hardcopies, etc., see
the instructions for Lab #2.
Good Luck and enjoy the project!