Revision dated 06/24/19
Educational Objectives: After completing this assignment, the student should be able to accomplish the following:
============================================================== rubric to be used in assessment -------------------------------------------------------------- Hash Table fhtbl.x com1 [Load, Dump] [0..5]: x fhtbl.x com2 [Includes] [0..5]: x fhtbl.x com3 [Remove, Size] [0..5]: x fhtbl.x com4 [Retrieve] [0..5]: x fhtbl.x com5 [Get, Put, operator[]] [0..5]: x fhtbl.x com6 [Iterator::operators ++,--] [0..5]: x fhtbl.x com7 [standard traversal] [0..5]: x fhtbl.x com8 [reverse traversal] [0..5]: x WordBench [wb4.x on text files] [0..5]: x requirements and SE [-50..5]: x log [-50..0]: x dated submissions deduction [2 pts each]: ( x) -- total: [0..50]: xx ============================================================== Notes: (1) Load(filename) tests Insert(k,d) (2) All tests use Load(filename) to instantiate a table (3) Some data files will be large (1,000,000 or more entries) to test runtime
Background Knowledge Required: Be sure that you have mastered the
material in these chapters before beginning the assignment:
Introduction to Sets,
Introduction to Maps,
Hashing, and
Hash Tables.
Operational Objectives: Implement the class templates HashTable<K,D,H>, ConstHashTableIterator<K,D,H>, and HashTableIterator<K,D,H>.
Deliverables:
hashtbl.h # contains HashTable<> , ConstHashTableIterator<> , and HashTableIterator<> template classes (including implementations) makefile.ht # builds all: fhtbl.x fhtblKISS.x fhtblModP.x fhtblMM.x fhtblSimple.x rantable.x hashcalc.x wordbench4.h # defines wordbench class using hashtable associative array wordbench4.cpp # implements wordbench class using hashtable associative array wordify.cpp # copy of file from project 3,4,5 makefile.wb4 # builds wb4.x log.txt # your project work log
The official development/testing/assessment environment is specified in the Course Organizer.
Create and work within the subdirectory ~/cop4530/proj6.
Do your own work. Variations of this project have been used in previous courses. You are not permitted to seek help from former students or their work products. For this and all other projects, it is a violation of course ethics and the student honor code to use, or attempt to use, code from any source other than that explicitly distributed in the course code library, or to give or receive help on this project from anyone other than the course instruction staff. See Introduction/Work Rules.
Begin by copying all files from the directory LIB/proj6 into your proj6 directory. At this point you should see these files in your directory (and possibly others):
fhtbl.cpp # test harness for hash tables rantable.cpp # random table generator hashcalc.cpp # hash calculator hashtbl.start # starting point for hashtbl.h main_wb4.cpp # driver for wordbench4 deliverables.sh # submission configuration file
Then copy these relevant executables:
LIB/area51/fhtblKISS_i.x # fhtbl_i.x with KISS hash function LIB/area51/fhtblMM_i.x # fhtbl_i.x with MM hash function LIB/area51/fhtblSimple_i.x # fhtbl_i.x with Simple hash function / non-prime flag LIB/area51/hashevalKISS_i.x # hash analysis with KISS LIB/area51/hashevalMM_i.x # hash analysis with MM LIB/area51/hashevalSimple_i.x # hash analysis with Simple/non-prime LIB/area51/rantable_i.x # random table generator LIB/area51/hashcalc_i.x # hash function calculator LIB/area51/wb4_i.x # wordbench4
The executables in area51 are distributed only for your information and experimentation, as well as the exercises in the lecture notes. You will not use these files in your own project, but they will help you understand hashing and hash tables and are very useful in preparing for the final exam. When you have questions about behavior of either hash tables or the router simulation, use these executable to find the answer.
You are to define and implement the template classes HashTable<K,D,H> and its associated iterator classes ConstHashTableIterator<K,D,H> and HashTableIterator<K,D,H>. Place definitions and implementations in the file hashtbl.h. Note that a lot of this work is already done in the startup file.
The makefile makefile.ht builds the supporting test infrastructure for hash tables. You can test different targets individually by naming them as an argument to the make command.
As an example client of hash tables, produce wordbench 4 which has behavior identical to wordbench 3, except that tabular output is no longer in dictionary order.
The makefile makefile.wb4 builds the hash table client wb4.x.
Submit the assignment using the script LIB/scripts/submit.sh.
Warning: Submit scripts do not work on the program and
linprog servers. Use shell.cs.fsu.edu to submit assignments. If you do
not receive the second confirmation with the contents of your assignment, there has
been a malfunction.
Implement the HashTable<K,D,H>, ConstHashTableIterator<K,D,H>, and HashTableIterator<K,D,H> classes as defined in the file LIB/proj6/hashtbl.start using the implementation plan discussed in the lecture notes. (Search for "TBS" to locate the places where additional code is required.)
Be sure not to change the definition of HashTable<> from that distributed in LIB/proj6/hashtbl.start.
Const iterators are read only and can be used in a const environment. Whereas the non-Const iterators are read/write. Read/write iterators for associative data structures would normally be a problem, because a client program could modify elements in a way that might compromise the internal consistency of the data structure. Just as for Map, our read/write iterators can be used to modify data only, not keys, thus making it impossible to use them to compromise the table structure.
Place all hash table code, including definitions and implementations for both hash table and hash table iterator, in the file hashtbl.h.
Thoroughly test your implementation for correct functionality using the provided test client fhtbl.cpp and tables generated with rantable.cpp. Test with small and large tables (at least 100,000 entries).
Once you are completely confident in your hash table code, create wordbench4.h and wordbench4.cpp (by revising copies of the wordbench3.h and wordbench3.cpp, rspectively) that gives an un-ordered version of WordBench.
Identical Output
Output from your project should be identical to that produced by the area51
examples, with these exceptions:
HashTable::Analysis() and HashTable::MaxBucketSize() are functional in the
area51 examples and wb4_i.x displays the underlying map technology being used.
Start NOW on HashTable<K,D,H> and test it. Future assignments will be based on your implementation, and you need to be sure it is working correctly before moving on.
Sample executables are supplied in LIB/area51. Table data for testing can be created with rantable.cpp.
The test harness fhtbl.cpp is set up for compilation using the c4530 macro, so no makefile is required for testing, and a working makefile.ht is simple to put together.