Extensible Hashing Example
Extensible Hashing Example
Data = {28,4,19,1,22,16,12,0,5,7}
Bucket limit = 3
28 = 11100
4 = 00100
19 = 10011
1 = 00001
22 = 10110
16 = 10000
12 = 01100
0 = 00000
5 = 00101
7 = 00111
Initialize the hash table with two initial directories and buckets. Set the global depth and bucket
depth to 1
Consider 28 = 11100. Take the global depth number of LSBs, which is currently one. We
consider 0 as it is the rightmost LSB in 11100, and 28 is placed in the "0" ID bucket
Consider 4 = 00100. Add it to the "0" ID bucket as one LSBs will be considered
Consider 19 = 10011. Add it to the "1" ID bucket as one LSBs will be considered
Consider 1 = 00001. Add it to the "1" ID bucket as one LSBs will be considered
Consider 22 = 10110. Add it to the "0" ID bucket as one LSBs will be considered
Consider 16 = 10000. Adding it to the "0" ID bucket makes it overflow, and the first condition is
satisfied where global depth == bucket depth
Split the bucket, grow directories, increment the global and bucket depths, and re-hash the
bucket elements according to two LSBs
Consider 12 = 01100. Adding it to the "00" ID bucket according to two LSBs makes it overflow,
and satisfies the first condition
Repeat the previous step and re-hash the elements of the bucket according to three LSBs
Consider 0 = 00000. Add it to the "000" ID bucket as three LSBs are considered
Consider 5 = 00101. Add it to the "101" bucket as three LSBs are considered
Consider 7 = 00111. Adding it to the "111" bucket according to three LSBs makes it overflow
The bucket depth is now less than global depth. So, the second condition is fulfilled, and now
only the bucket split step is executed. Elements are re-hashed according to the global depth,
which is still 3.