// File: hash.h // // Header file for a hash table of student records #ifndef _hash_h #define _hash_h #include "genlist4.h" #include "student.h" typedef int hash_t ; typedef GenList StudentList ; typedef Iterator SLIterator ; class HashTable { public: HashTable(int) ; // Make table with approx. given size ~HashTable() ; void insert(const StudentRecord&) ; // Add item to table bool find(hash_t, StudentRecord&) ; // Find item with given ssn int extract(hash_t) ; // Remove items with given ssn void dump() ; // Dump out entire table void stats() ; // Print out collision statistics protected: StudentList *table ; // Array of lists int tsize ; // Table size, should be prime int count ; // number of items in the table int hash(hash_t) ; // hash function } ; #endif