Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started