INTERMEDIATE🔥 High-Yield Exam Topic 4 min read 4 views
AVL Trees, Binary Heaps & Hashing Probe Complexity
Minimum nodes in AVL tree of height h, O(n) Build-Heap proof, and LL/RR/LR/RL rotation rules.
Binary Heap Index Formulas (0-based vs 1-based)
| Convention | Root | Left Child of | Right Child of | Parent of |
|---|---|---|---|---|
| 1-Based Array | ||||
| 0-Based Array |
💡 Shortcut & Tip
Finding Maximum in a Min-Heap: In a Min-Heap of distinct elements, the maximum element MUST reside in one of the leaf nodes, so finding it requires comparisons in the worst case!
AVL Rotations Summary
- Single Rotation (1 rotation): Triggered by outer insertion LL (Right Rotate) or RR (Left Rotate).
- Double Rotation (2 rotations): Triggered by zig-zag inner insertion LR (Left then Right) or RL (Right then Left).
- In AVL insertion, fixing the lowest imbalanced ancestor restores balance to the entire tree ( rotations!). In AVL deletion, rotations may propagate up to the root ( rotations).
📐 Quick Revision Formula Sheet
Minimum Nodes in AVL Tree of Height h
💡 Sequence: 1, 2, 4, 7, 12, 20, 33, 54... (Fibonacci shifted!)
Leaf Nodes in n-element Binary Heap
💡 Build-Heap runs in tight O(n) time, NOT O(n log n)!
#Data Structures#AVL#Heap#Hashing
🎯 Practice PYQs on This Topic (3)
Q1.GATE CS DSAMCQMEDIUM
+2 Marks • -0.67 NegWhat is the tight worst-case time complexity of building a Binary Max-Heap bottom-up (Build-Max-Heap) from an unsorted array of elements?
Q2.GATE CS DSAMCQMEDIUM
+2 Marks • -0.67 NegWhat is the minimum number of nodes in an height-balanced AVL tree of height (where a single root node has height )?
Q3.UGC NET / GATE DSAMCQEASY
+1 Marks • -0.33 NegWhich open-addressing collision resolution technique eliminates both primary and secondary clustering?