4 #define LOADFACTOR 0.75
7 typedef struct hashlistnode {
9 void *val; //this can be cast to another type or used to point to a larger structure
10 struct hashlistnode *next;
13 typedef struct hashtable {
14 mhashlistnode_t *table; // points to beginning of hash table
16 unsigned int numelements;
20 /* Prototypes for hash*/
21 mhashtable_t *mhashCreate(unsigned int size, float loadfactor);
22 unsigned int mhashFunction(mhashtable_t *table, unsigned int key);
23 void mhashInsert(mhashtable_t *table, unsigned int key, void *val);
24 void *mhashSearch(mhashtable_t *table, unsigned int key); //returns val, NULL if not found
25 int mhashRemove(mhashtable_t *table, unsigned int key); //returns -1 if not found
26 void mhashResize(mhashtable_t *table, unsigned int newsize);