Question
Any insight/implement to the following functions would be appreciated. Note that the bucket number where you put a key-value pair is HashTable hash(key) mod NumberOfBuckets.
Any insight/implement to the following functions would be appreciated. Note that the bucket number where you put a key-value pair is HashTable hash(key) mod NumberOfBuckets.
(C program)
HashTable* newHashTable(unsigned int mxs) {
// implement a constructor that builds a hashtable relying on auxiliary chaining. Write a hash function that is suitable for strings.
}
static HTNode* findInList(HTNode* head, char * key) {
//given a head of a list, return the node that has the key
}
void HashTable_add (HashTable * t, char * key, char * value) {
//add the key/value to the hash table t. DO NOTHING if the key is already in the hash table
}
char* HashTable_get(HashTable* t, char* key) {
//returns the value associated to key in t. if there is no such value return NULL
}
void HashTable_remove(HashTable *t, char* key) {
//removes the pair identified by key from the hashtable t
unsigned int HashTable_max_length(HashTable* t) {
//find the length of the longest list. return 0 if the hash table is empty
l typedef struct HTNodeTag t char char struct HTNodeTagnext; key; value HTNode; 7 typedef struct HashTableTag t unsigned int Number of buckets in the hash table HTNode* ht: 0 HashTable 2 unsigned int HashTable hash (char* str); 3 HashTable neHashTable (unsigned int mxs) 1 void 5 char * 6 void 7 void 8 char* 9 unsigned int HashTable max_length (HashTable t); HashTable_add (HhTable*t,char- key, char value) HashTable get (HashTable* t, char* key) HahTable_remove (HashTable t, char key) deleteHashTable (HashTable* t) HahTable_max_key (HashTablet char )Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started