Apple interview question

Implement an algorithm to recursively travel a tree