Depth First Search- Implementation

Here is the code:- https://ide.codingblocks.com/s/431038, for depth first search, please specify the error in the code.

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.

@Sakshi2004
if you feel that your doubt is cleared you can mark this as resolved.
Happy Learning!!

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.