Module 8 · Graphs and Trees · Binary Tree

Validate binary search tree

Checking each node against its children isn't enough: a value deep in the left subtree can still be too big. So each subtree reports its smallest and biggest value, and a node checks the left side's max and the right side's min.

Under a finished node of tree is its subtree's [min, max].