Doubt with DFS while in case of tree

if we make a tree and want to use DFS so do we need to use Visited hash map. can we do it without any error

Hi. I didnt get ur doubt exactly. But for DFS u would have to maintain a visited map otherwise u would end up calling the same node again and again

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.