Extendible hashing (code by Clade, guidance by Georgios Evangelidis)

The directory has 2d entries, indexed by the last d bits of h(k), where d is the global depth. Several entries can point to the same bucket; a bucket's local depth is how many trailing bits its keys are guaranteed to share. When a bucket overflows it splits on one more bit, and the directory doubles only if that bucket already uses all d bits.

Keys or ranges, e.g. 5, 8, 10-30, 0-100 step 5
On delete
Table
History
Global depth 0 Directory entries 1 Buckets 1 Keys 0 Bucket utilisation 0%

Operation log

    Reading the diagram

    Directory entry, labelled by its d-bit index
    Bucket with its name and local depth
    Entry or bucket read by the current operation
    Key found

    Under each key are the last d bits of h(k). The coloured ones are the bucket's local-depth bits, which every key in that bucket shares; a bucket with local depth ℓ is pointed to by 2d−ℓ entries.

    Hashing keeps no key order, so a range can only be answered by looking up each value, or by scanning every bucket.