Seth.

Depth-First Search (DFS)

0123

Depth-First Search - Technical Overview

1. Algorithm Description: DFS is a graph traversal algorithm that starts at a source node and explores as far as possible along each branch before backtracking.

2. Steps of DFS:

3. Time Complexity: O(V + E) where V is the number of vertices and E is the number of edges.

4. Space Complexity: O(V) due to the storage of visited nodes.

5. Usage: DFS is commonly used for tasks like detecting cycles, pathfinding in mazes, and analyzing connectivity in graphs.