Project 3: Hash Tables!
Due: Monday 10/26/2009
For this
assignment you will implement a superTable data structure to store a collection
of students with integer id numbers and double gpa scores. The superTable must implement the following
methods:
class SuperTable
{
public:
//add
new student with given id and gpa to data structure
void
insertStudent( unsigned int id, double gpa );
//return
the gpa of the student with given id.
//Return
-1 if student is not in data structure
double
getGPA( unsigned int id );
//change
the gpa of the student with the given id
//to
newGPA.
void
updateGPA( unsigned int id, double newGPA );
};
Further, your
superTable must consist of 2 sub-data structures. The first is a hash table of students that
resolves collisions via chaining. The
second is a Bloom filter. The Bloom
filter should be used to speed up the getGPA method for the cases in which the
requested student is not in the hashtable, and the insertStudent method in the
cases in which the student is already in the table.
You must design
your data structure so that it can quickly deal with all queries even if there
are 1,000,000 students in the data structure.
You should experiment with different size inputs. How big should your hash table and Bloom
filter be to deal with different numbers of students n? How many hash functions k should you use for
your Bloom filter? Include a 1-page
write up analyzing the speed of different Bloom filter and Hash table sizes,
along with the number of hash functions used.