Checking only the parent fails
transcript
You check a tree, node by node. Each one agrees with its parent. So it must be a search tree. Many people write this check in an interview. Or is it?
Twenty five is below forty. Good. Thirty is above twenty five. Good. Fifty five is above thirty. Good. Every pair passes. So the check says yes.
Fifty five hangs on the left of forty. But it is larger than forty. The rule breaks at the root. A search for fifty five would miss it. It would go right at forty, and never look left.
Pass down a range of allowed values. Going left, the node becomes the upper limit. Going right, it becomes the lower limit. Fifty five fails the limit of forty. Each call carries a low and a high limit.
The rule covers whole subtrees. Not only children. Try it in the sandbox. Full breakdown in the lecture.