Sigma Computing interview question

It was a tree traversal problem.