Compass interview question

Code challenge, binary tree traversal