Meta Interview Question

Please see above. Tree traversal and sorting