RK DSA Studio

Depth-first search

Explore one unvisited branch as far as possible before returning to try another.

Remember: Go deep; return; try the next branch.

Example: A → B → C explores C before returning to B.

Time: O(V + E). Auxiliary space: O(V).

Formula: Mark → explore unvisited neighbors → return

Up to 8 unique integer vertex labels and 16 edges. Edges: from,to; separate edges with semicolons. Directed graph. Explore only the source component. Graph storage O(V + E) is excluded from auxiliary space.

Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.

The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.