A parent-only check accepts every edge. List inorder values and find the missing obligation.
What compact state preserves all ancestor obligations?
1 / 6
Validate Binary Search Tree — predict before coding
A node must satisfy constraints from all ancestors, not just its parent. Bounds are a compact representation of those inherited obligations.
Decision: Why is root 10 with right child 15 and that child’s left child 6 not a valid BST?
2 / 6
Kth Smallest Element in a BST — predict before coding
Inorder traversal turns strict BST order into rank order. A stack can pause that traversal after the kth visit instead of materializing every value.
Decision: In a BST whose inorder values are [1,3,4,8], how many pops identify k=3 and what value is returned?
3 / 6
BST Iterator — predict before coding
An iterator stores a suspended traversal, not a precomputed sorted array. Its stack is the frontier needed to produce exactly the next inorder value.
Decision: Can one Next call take O(h) work even though Next is described as amortized O(1)?
4 / 6
Minimum Absolute Difference in BST — predict before coding
In a sorted sequence, a closest pair is adjacent. The BST supplies that sequence through inorder traversal, so only the previous value must be retained.
Decision: For inorder values [-5,-1,4,10], which pair gives the answer?
5 / 6
An iterator is paused work
Root 7 has left leaf 1 and right child 11 with left leaf 9.
Draw the pending stack after construction and after each of the first two Next calls. Then change the task to repeated kth queries: what additional state might help?
6 / 6
←/→ or click edges to navigate · ? help · N notes · F fullscreen