

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The hash table implementation from Lecture 20 uses a vector of lists. Dur- ing the process of automatically resizing the table, a significant amount of copying and re-allocation occurs, most of it hidden inside the functionality of the list and vector classes. An alternative technique is to use our own linked list implementation. That way we can ensure that minimal copying and no reallocation (other than resizing the m_table vector) occurs during resize_table. Lab 11 explores this implementation. Download the files:
http://www.cs.rpi.edu/academics/courses/spring08/cs2/lab11/hash_set.h http://www.cs.rpi.edu/academics/courses/spring08/cs2/lab11/test_hash_set.cpp
Then, turn off all network connections. Examine the code in hash_set.h and test_hash_set.cpp. You will notice several changes over the version covered in lecture.
You should also examine the test main program. Several functions in hash_set.h have not been implemented. These should be implemented as part of the checkpoints of this lab.
insertion (at the front of the list is fine) once the correct list has been found (using the hash function) and it has been determined that the key value is not already in the list. The function should store the hash value (not the index) computed by the hash function in the HashNode. The function should increment the size counter and it should return the appropriate iteriator/bool pair.