Amazon interview question

How to implement tree using dfs algorithm