chap searching /*insert record with key into ht *void hashinsert(key ke rint home/home position for int pos home ( )/initial position for (int = ht[pos!nulli++pos (home (ki) /next pobe slot assert ht[poskey(compareto( ! "duplicates not allowed"ht[posnew kvpair(kr)/insert figure insertion method for dictionary implemented by hash table /*search in hash table ht for the record with key * hashsearch(key kint home/home position for int pos home ( )/initial position for (int (ht[pos!null&(ht[poskey(compareto( ! ) ++pos (home (ki) /next probe position if (ht[pos=nullreturn null/key not in hash table else return ht[posvalue()/found it figure search method for dictionary implemented by hash table method hashinsert first checks to see if the home slot for the key is empty if the home slot is occupiedthen we use the probe functionp(kito locate free slot in the table function has two parametersthe key and count for where in the probe sequence we wish to be that isto get the first position in the probe sequence after the home slot for key kwe call ( for the next slot in the probe sequencecall ( note that the probe function returns an offset from the original home positionrather than slot in the hash table thusthe for loop in hashinsert is computing positions in the table at each iteration by adding the value returned from the probe function to the home position the ith call to returns the ith offset to be used searching in hash table follows the same probe sequence that was followed when inserting records in this waya record not in its home position can be recovered java implementation for the search procedure is shown in figure both the insert and the search routines assume that at least one slot on the probe sequence of every key will be empty otherwisethey will continue in an infinite loop on unsuccessful searches thusthe dictionary should keep count of the