Search⌘ K

Challenge: Implement Depth-First Search

Explore how to implement depth-first search on a directed graph represented by an adjacency array. Learn to traverse the graph starting from a specified vertex and return the traversal order. This lesson helps you understand key graph traversal concepts and practice coding DFS in C++ to prepare for interviews.

We'll cover the following...

Statement

Given a directed graph represented by an adjacency array graph and an integer source, representing the start vertex of the graph, return an array of integers, result that shows the order of depth-first traversal starting from the specified source vertex.

Constraints

  • 11 ...