Id dfs same as the has Path problem

Since both use stack. Difference is that the hasPath uses recursion and indirectly uses recursion and DFS uses iterative approach with direct stack usage

Depth First Search(DFS) is used for traversal it can be implemented using recursive stack as well as direct(physical) stack. hasPath is one of its applications only.So hasPath can also be done using recursive and physical stack.

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.