Question: The code has following 4 functions: div _ hash ( int key, int M ) : divides key k with M size of hash table

The code has following 4 functions:
div_hash(int key, int M): divides key k with M size of hash table and use remainder of it, returns hash value
h(K)=kmodM
k=12345
M=95
h(12345)=12345mod95
,=90
mid_sqr_hash(int key, int M): it has 2 steps:
Square the key k, which is k**k.
Take digits from square of key by dividing it by M and further mode by M, return hash value
h(K)=h(kxk)
k=60
M=100
kxk=6060
=3600
h(60)=60??100%100
The hash value obtained is 60
double_hash (int key, int M):
h1(key)=key%M
h2(key)=1+( key %13)
example : key =12345
M=1000
h1(12345)=345
h2(12345)=1+(12345%13)=1+8=9
i=1 rehash =345+1**9=354,354 is not palindrome
i=2 rehash =345+18=363 is palindrome stop
if i>5 and rehash value is not palindrome then make reverse of rehash as hash value.
return hash value
mult_hash(int key, int A):
Perform following steps:
Choose a value A from AMCt+
 The code has following 4 functions: div_hash(int key, int M): divides

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!