Index Structures Compared: B-Tree, Binary Search Tree and Hash Table Lookup Costs
Index Structures Compared: B-Tree, Binary Search Tree and Hash Table Lookup Costs.
A database index trades memory and write effort for fast lookups, and the right structure depends on what a lookup costs. This simulator stores random keys in a real B-tree, a binary search tree grown in random order, a sorted array and two open-addressing hash tables, runs thousands of lookups on them, and counts key comparisons and disk-page reads. The measured averages are shown next to the textbook closed forms: probes of 1/2(1+1/(1-a)) and 1/2(1+1/(1-a)^2) for linear probing, 1/(1-a) for double hashing, 2(1+1/N)H_N - 3 for a random binary search tree and the logarithmic height bounds of a B-tree.
Index Structures Compared: B-Tree, Binary Search Tree and Hash Table Lookup Costs.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install