Google Interview Question

A basic tree algorithm with different node definition