A PARTS file with Part# as hash key includes records with the following Part# values: 2369, 3760, 4692, 4871, 5659, 1821, 1074, 7115, 1620, 2428, 3943, 4750, 6975, 4981, 9208. The file uses 8 buckets, numbered 0 to 7. Each bucket is one disk block and holds two records. Load these records into the file in the given order using the hash function h(K)=K mod 8. Calculate the average number of block accesses for a random retrieval on Part#.
Solution
How to fill this table
divide each value by 8 then take out the remainder
2369-1
3760-0
4692-4
4871-7
5659-3
1821-5
1074-2
7115-3
1620-4
2428-4
3943-7
4570-6
6975-7
4981-5
9208-0
0 |
3760 |
9208 |
|
1 |
2369 |
||
2 |
1074 |
||
3 |
5659 |
7115 |
|
4 |
4692 |
1620 |
2428(OVERFLOW) |
5 |
1821 |
4981 |
|
6 |
4750 |
||
7 |
4871 |
3943 |
6975(OVERFLOW) |
OVERFLOW
it allow only 2 posts
but we have overflow at 4 & 7
Please use chaining to solve this
During calculation of average block reads we have 2 block requiring 2 block, and 13 requiring only 1
so
we have
=13/15\*1+2/15*2
=17/15
=17/15 block accesses
---
all the best
if there is anything, please let me know, love to help
please upvote
A PARTS file with Part# as hash key includes records with the following Part# values: 2369,...