Google Interview Question

Coding exercise on sorting, tree