


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Hash function H(x) maps the value x at the index x%10 in an Array.
struct DataItem *search(int key) { //get the hash int hashIndex = hashCode(key); if(hashArray[hashIndex]->key == key) return hashArray[hashIndex]; return NULL; }
void insert(int key,int data) { struct DataItem item = (struct DataItem) malloc(sizeof(struct DataItem)); item->data = data; item->key = key; //get the hash int hashIndex = hashCode(key); hashArray[hashIndex] = item; }