Slideshow:
|
Parameter i determines the number of logical hash buckets
|
|
|
|
Example:
|
|
$64,000 question:
|
Answer:
|
|
|
|
Answer:
|
|
Parameter: i = # bits used in RandomNumGen
Insert( x, recordPtr(x) )
{
k = h(x); // Genenral Hash function value
j = k % 2i ; // Extensible hash function value
Read disk block at bucket[j] (1 block) into memory;
if ( bucket[j] block has space for a search key )
{
Insert (x, recordPtr(x) ) into the block;
Write block back to disk;
return; // Done !
}
/* -------------------------------------
bucket[j] disk block is full
We must allocate a new disk block
------------------------------------- */
/* ========================================================
Check if we need to double the logical hash table size
========================================================= */
Let i' = integer label of physical bucket[j] block;
if ( i' == i )
{
Double the logical hash table;
i = i + 1; // We use 1 more bit to hash
Before:
|