Amazon Interview Question

Something about tree traversal.