Pattern Recognition Drill
Easy Trees
The Problem
Insert a value into a binary search tree.
What approach would you use?
Think about it before scrolling down.
Compare value with node, go left or right. When you hit None, create the new node. O(h) time.
Common Trap
Don't forget to return the modified subtree root (or assign node.left/right = recursive call).