This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CMSC 216 Project #2 Fall 2011 Hash Table I Due: October 2, 2011, 6PM In this project, you will implement a hash table with the open addressing scheme (with a simplified form of quadratic probing) that you learned about in lecture/discussion. To aid in learning to write your own tests, you will also write a testing program that will give you practice in reading from files. 1 Software Plagiarism Source code for projects in this course, starting with project 2, will be scanned for similarity to other students’ projects, both this year and, when applicable, previous years. This comparison is not sensitive to changes in variable names, white space, etc. See Section 7.1 for more info. You have been warned. 2 Procedure 2.1 Obtain the project files We have supplied three files for your use in this project: (a) hashtable.h , which provides prototypes for the functions your hash table must implement; (b) .submit , which is necessary to submit the project to the submit server; and a (c) Makefile , which will help you work on your project more efficiently. These files are contained in ~/216public/project2/project2.tgz ; you should copy this file to your home directory and extract the files in a similar manner to the procedures you followed in Project #1. Your code for this project should be contained in your ~/216/project2 subdirectory, which is created by extracting files from the tarball you copied. 2.2 Implement the hash table Create a file named hashtable.c to contain your implementation of the hash table. Your hash tables need to use an open addressing, quadratic probing approach to resolving hash collisions, as discussed in lecture. Both the keys and the values to be inserted into your hash tables are strings ( char pointers). You must use the hash code algorithm defined in Section 3.2.2 to generate the hash codes for your keys, since we will be inspecting the state of your hash table, and using a different algorithm will generate incorrect results. 2.3 Write the testing program You will also be writing a program that reads in operations from a file (or standard input), and then perform those operations on a hash table. The testing program is compiled against a hash table implementation and is used to test that implementation. 3 Specifications 3.1 Use of a Makefile Makefiles will be covered more in-depth in class, but instead of issuing gcc commands every time you want to recompile your program, you can simply execute “ make ” from the command line. Make recompiles your hashtester program, as well as any public tests we give you. 3.2 Hash Table The hash table you will implement is a fixed-size hash table using open addressing (with quadratic probing to handle collisions)....
View Full Document
- Spring '11
- hash function, ASCII