Explain depth-first search.

Explain depth-first search.



From the root node:
- explores the deepest nodes first (last generated node)
- moves towards the next deepest node.

Implemented using LIFO queue data structure.

Disadvantage - may not terminate = go into infinitely on one path not guaranteed to find the shortest path - unless it goes through
the whole tree.


Learn More :