Here is the code:- https://ide.codingblocks.com/s/431038, for depth first search, please specify the error in the code.
Depth First Search- Implementation
Hello @Sakshi2004 you are not making use of the visited array mark your visited nodes as true so you should not traverse over them again and again.
Ok Yes the vertices need to be marked as true, Thank You.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.