July 2009

HashTable implemented using quadratic probing for collision resolution

Using quadratic probing for collision resolution #define ERROR_TABLE_FULL -1 #define ERROR_RECORD_NOT_FOUND -1 #define ERROR_DUPLICATE_RECORD -1   class HashTable{ public: HashTable(int table_size); int insert(const string &record); int retrieve(const string &record); private: int hash(const string &record); int hash_size; int record_count; string* table; };   /** * Constructor accepting table_size */ HashTable::HashTable(int table_size){ hash_size = table_size; table = …

HashTable implemented using quadratic probing for collision resolution Read More »

HashTable implemented using linear probing for collision resolution

Using linear probing for collision resolution in hashtable   #define ERROR_TABLE_FULL -1 #define ERROR_RECORD_NOT_FOUND -1 #define ERROR_DUPLICATE_RECORD -1   class HashTable{ public: HashTable(int table_size); int insert(const string &record); int retrieve(const string &record);   private: int hash(const string &record); int hash_size; int record_count; string* table; };   /** * Constructor accepting table_size */ HashTable::HashTable(int table_size){ hash_size …

HashTable implemented using linear probing for collision resolution Read More »