Google interview question

A basic tree algorithm with different node definition