Question: Please help. Dont understand . The code has following 4 functions: 1 ) div _ hash ( int key, int M ) : divides key
Please help. Dont understand The code has following functions:
divhashint key, int M: divides key k with M size of hash table and use remainder of it returns hash value
hK k mod M
k
M
h mod
midsqrhashint key, int M: it has steps:
Square the key k which is kk
Take digits from square of key by dividing it by M and further mode by M return hash value
hK hk x k
k
M
k x k x
h
The hash value obtained is
doublehash int key, int M:
hkey keyM
hkeykey
rehashkey hkeyihkey i starts from repeat untill you get hashvalue which is palindrome number
example : key
M
h
h
i rehash is not palindrome
i rehash is palindrome stop
if i and rehash value is not palindrome then make reverse of rehash as hash value.
return hash value
multhashint key, int A:
Perform following steps:
Choose a value A from
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
