Dr. Mohsin Dar
Assistant Professor
Cloud & Software Operations Cluster
UPES - MTech First Semester
Figure: Visual representation of hashing process
Keys: 12, 17, 23, 8, 31, 19
Dynamic hashing techniques that can grow and shrink based on the number of records
Extendable Hashing & Linear Hashing
Local Depth ≤ Global Depth for all buckets
Problem: Inserting 20 (10100) → ends with "00"
Bucket A is full!
Solution: Global depth = local depth
→ Double directory (d=3)
→ Split bucket using 3rd bit
| Name | First Letter | Hash (binary) |
|---|---|---|
| Arun | A | 000 |
| Aditi | A | 001 |
| Aman | A | 010 |
| Bharat | B | 100 |
| Bina | B | 101 |
Aditi (001) is added to B0
Aman (010) causes split
Key: GD=2 (Global Depth), LD=Local Depth
where N0 = initial number of buckets
Hash Functions:
h0(k) = k mod 4
h1(k) = k mod 8
| Aspect | Extendable Hashing | Linear Hashing |
|---|---|---|
| Directory | Required (can double in size) | Not required |
| Growth Pattern | Exponential (doubles) | Linear (one bucket at a time) |
| Split Trigger | Bucket overflow | Load factor threshold |
| Which Bucket Splits | Overflowing bucket | Next in round-robin order |
| Space Overhead | Directory space overhead | Minimal overhead |
| Performance | 1-2 disk accesses | 1-2 disk accesses + overflow |
| Complexity | Moderate | Higher (multiple hash functions) |
SELECT * FROM Students WHERE StudentID = 12345SELECT * FROM Employees WHERE Age > 30 AND Age < 50| Operation | Hash Index | B+Tree Index |
|---|---|---|
| Equality Search | O(1) average | O(log n) |
| Range Search | O(n) - Not supported | O(log n + k) |
| Insert | O(1) average | O(log n) |
| Delete | O(1) average | O(log n) |
| Ordered Traversal | O(n log n) - Not supported | O(n) |
Dr. Mohsin Dar
Assistant Professor
SOCS | UPES
Next: Tree-Based Indexing Deep Dive