For questions #4 through #6, insert the following elements into the hash tables
ID: 3829094 • Letter: F
Question
For questions #4 through #6, insert the following elements into the hash tables using the collision resolution algorithms specified. The tables are of size 11, so assume that to determine the hash value for a given input, key, we calculate hash(key, 11). int hash(char *s, int table_size) {if (s == NULL || s[0] == '') return 0; else return ((int) (tolower (s [0]) - 'a') + 1) % table_size;} Keys to insert: "abacus", "dwindle", "fox", "goose", "bag", "beans", "ferocious", "delicate" Insert the elements into this hash table using linear probing to resolve collisions: Insert the elements into this hash table using quadratic probing to resolve collisions: Insert the elements into this hash table using separate chaining to resolve collisions:Explanation / Answer
[4]
Table_sixe = 11
"abacus" --> 1
"dwindle" --> 4
"fox" --> 6
"goose" --> 7
"bag" --> 2
"beans" --> 2
"ferocious" --> 6
"delicate" --> 4
Linear Probing: In linear probing, we linearly probe for next slot
0
1 -->"abacus"
2 -->"bag"
3 -->"beans"
4 -->"dwindle"
5 -->"delicate"
6 -->"fox"
7 -->"goose"
8 -->"ferocious"
9
10
--------------------------------------------------------------
[5]
Table_size = 11 =key
"abacus" --> 1
"dwindle" --> 4
"fox" --> 6
"goose" --> 7
"bag" --> 2
"beans" --> 2
"ferocious" --> 6
"delicate" --> 4
Quadratic Probing look for i^2'th slot in i'th iteration
0
1 -->"abacus"
2 -->"bag"
3 -->"beans"
4 -->"dwindle"
5 -->"delicate"
6 -->"fox
7 -->"goose"
8
9
10 --> "ferocious"
------------------------------------------------------------------------------------------
[6] Seperate chaning
Table_size = 11 =key
"abacus" --> 1
"dwindle" --> 4
"fox" --> 6
"goose" --> 7
"bag" --> 2
"beans" --> 2
"ferocious" --> 6
"delicate" --> 4
0
1 -->"abacus"
2 -->"bag -->"beans"
3
4 -->"dwindle" -->"delicate"
5
6 -->"fox --> "ferocious"
7 -->"goose"
8
9
10
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.