Citadel·Software Engineer·Technical Phone Screen
- Walk through the time complexity of insert, search, and delete on a BST in both average and worst case. What causes the worst case and how does the tree degenerate?
- How would you modify your BST implementation to make it an AVL tree? Explain the node augmentation and when rotations fire.
- How would you extend the BST to a Red-Black tree? What invariants do you need to maintain and how do recolor and rotation interact after insertions and deletions?
- Compare AVL trees and Red-Black trees. When would you pick one over the other in practice?
“I knew the O(log n) average answer cold but fumbled explaining WHY the worst case is O(n).”