Google Interview Question

Please create a tree algorithm (coding test1)