Extensible Hashing: Example 1
Initial state
Insert the
search key X
that has a hash value h(X) = 1011
Extensible Hashing: Example 1
Find the
(physical) hash bucket to
insert:
Insertion will
cause bucket (disk block)
to overflow
Extensible Hashing: Example 1
Because
i' = i,
we must double the logical hash table size
(i++):
We must also
map the
new logical bucket to
their physical buckets
Extensible Hashing: Example 1
We split the
physical bucket
(to free space for insertion)
Update
the physical bucket i' parameter to
2
Extensible Hashing: Example 1
Adjust the
logical → physical mapping
After the split, we try the
insertion
again...
Extensible Hashing: Example 1
Hash - now
we use i = 2 bits:
We find bucket 11 (binary)....
Extensible Hashing: Example 1
Insert is now
successful:
Done !
Extensible Hashing: Example 1
Redrawn:
Extensible Hashing: Example 2
Initial state:
Insert
the search key X
that has a hash value h(X) = 0010
Extensible Hashing: Example 2
Find the
hash bucket to
insert:
Insert
the search key X
that has a hash value h(X) = 0010
Extensible Hashing: Example 2
Insertion is
successful !!!
Notice that we
only need
1 bit
to obtain
the hash value !!
Extensible Hashing: Example 2
This figure clearly shows that
00 and
01 are
mapped to
physical bucket 00:
Extensible Hashing: Example 3
Initial state
Insert the
search key X
that has a hash value h(X) = 0000
Extensible Hashing: Example 3
Find the
(physical) hash bucket
to insert:
Insertion
will cause bucket (disk block)
to overflow
Extensible Hashing: Example 3
Find the
(physical) hash bucket
to insert:
Because
bucket i' < i,
we do not
increase i !!!
Extensible Hashing: Example 3
We split
the physical bucket
(to free space for insertion)
Update the
physical bucket i' parameter
to 2
Extensible Hashing: Example 3
Adjust the
logical → physical mapping
After the split,
we try the
insertion again....
Extensible Hashing: Example 3
Hash again -
still using
2 bits
We find
bucket 00 (binary)....
Extensible Hashing: Example 3
Insertion is
successul
Done !!!
❮
❯