Identify the invariant behind each result. Account for singleton rings, traversal output order, mirrored graph bits, and subtree sizes after rotation.
Lessons
- Circular linked lists: keep one tail and a valid cycle
- Binary-tree traversals: four orders without recursion
- Dense graph bitsets: adjacency and common neighbors
- AVL order statistics: maintain subtree sizes for rank and select
