Complete C code for searching, inserting, and deleting a closed hash
/* Close the creation, search, insertion, and deletion of the hash list */# include
# Define NIL-1 // assume that the keyword is a non-negative integer # define DEL-2 typedef int KeyType; KeyType HashTable [13]; // It is easy to verify the algorithm. The number of keywords is assumed to be 13, hash table length: 13 // keyword insertion function void InsertHashTable (KeyType k) {for (int I = 0; I <13; I ++) if (NIL = HashTable [(k % 13 + I) % 13] | DEL = HashTable [(k % 13 + I) % 13]) {HashTable [(k % 13 + I) % 13] = k; break;} // the query operation for the hash table. If the query is successful, the following table is returned, otherwise, return-1int HashSearch (KeyType k) {int I = 0; while (I <13) {if (k = HashTable [(k % 13) + I) % 13]) return (k % 13) + I) % 13; else if (NIL = HashTable [(k % 13) + I) % 13]) return-1; I ++;} if (13 = I) return-1;} // create a hash table void CreateHashTable () {int n; KeyType key; for (int I = 0; I <13; I ++) HashTable [I] = NIL; printf ("Enter the number of keywords: \ n "); scanf ("% d", & n); printf ("Enter the value of % d keywords: \ n", n); for (I = 0; I