Build hierarchy tree tutorial

Backstory: Build hierarchy tree tutorial teaches how to build a hierarchy tree from the employee list and their manager ids. The solution uses recursion. This is Amazon’s question for software engineer position.

Why I picked this question: This is a question you cannot solve in 30 minutes (if you didn’t see it before). The interviewer might know that too. So he asks what data structure you are going to use. He wants to know how you approach the question. The most common data structures are ArrayList, HashMap and trees.

Download source code
Java coding interview youtube series

Comments are closed