Honeywell interview question

Tree traversal algo