Question d’entretien chez Amazon

How to implement tree using dfs algorithm