Intel Corporation interview question

traversing tree python code, data structure code