|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Linear hashing with dynamic bucket expansion. More...
#include <iostream>#include <primes.H>#include <dlink.H>#include <htlist.H>#include <tpl_dynArray.H>#include <hashDry.H>#include <hash-fct.H>#include <hash-dry.H>#include <ah-errors.H>Go to the source code of this file.
Classes | |
| class | Aleph::GenLhashTable< Key, BucketType, Cmp > |
| Generic hash table with collision resolution by separate chaining. More... | |
| class | Aleph::GenLhashTable< Key, BucketType, Cmp >::Iterator |
| Iterator over a GenLhashTable hash table. More... | |
| struct | Aleph::LhashBucketVtl< Key > |
| Bucket with virtual destructor for a hash table with collision resolution by separate chaining. More... | |
| struct | Aleph::LhashTable< Key, Cmp > |
| Generic hash table with collision resolution by separate chaining and buckets without virtual destructor. More... | |
| struct | Aleph::LhashTableVtl< Key, Cmp > |
| Generic hash table with collision resolution by separate chaining and buckets with virtual destructor. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Typedefs | |
| template<typename Key > | |
| using | Aleph::LhashBucket = Dnode< Key > |
| Bucket without virtual destructor for a hash table with collision resolution by separate chaining. | |
Linear hashing with dynamic bucket expansion.
This file implements Linear Hashing, a dynamic hash table technique that grows gracefully without requiring a complete rehash. Buckets are split one at a time as the load factor increases.
Linear hashing uses two hash functions during expansion:
When a bucket overflows, the next bucket in sequence is split, not necessarily the overflowing one. This ensures predictable growth.
| Operation | Average | Worst Case |
|---|---|---|
| insert | O(1) | O(n) |
| search | O(1) | O(n) |
| remove | O(1) | O(n) |
| expand | O(1) amortized | O(n) |
upper_alpha: When exceeded, triggers bucket splitlower_alpha: When below, triggers bucket contraction| Feature | LhashTable | ODhashTable | OLhashTable |
|---|---|---|---|
| Collision | Chaining | Double hash | Linear probe |
| Growth | Linear | Full rehash | Full rehash |
| Memory | Extra pointers | Compact | Compact |
Definition in file tpl_lhash.H.