Question
66, 47, 87, 90,126, 140, 145,153, 177, 285, 393, 395, 467,566, 620, 735 Store the values in a hash table with 20 positions using thedivision method of hashing (key% tablesize) and linear probing((key +1)% tablesize) to resolve collisions. Please include ashort description of the math for my understanding, thanks. willrate 66, 47, 87, 90,126, 140, 145,153, 177, 285, 393, 395, 467,566, 620, 735 Store the values in a hash table with 20 positions using thedivision method of hashing (key% tablesize) and linear probing((key +1)% tablesize) to resolve collisions. Please include ashort description of the math for my understanding, thanks. willrate
Explanation / Answer
please rate - thanks you didn't say in python! #include using namespace std; int main() {int key, code,table[20]={0},i,tablesize=20; coutkey; while(key>0) {code=key%tablesize; //hash function {i=0; while(table[code]>0) //anything there already? collision? {code=(key+i)%tablesize; //yes,apply new hash function i++; } table[code]=key; //insert into table for(i=0;i