Consider the following given tree:
I want to get the following output:
1 2 4 2 5 2 6 2 1 3 7 8 7 9 7 3 1
This is also called the Euler Tour of the tree.
However, if I use DFS I get the follwing output:
1 2 4 5 6 3 7 8 9
Can you tell how to modify the DFS code in such a manner that I get the required output?