This lab assignment asks the student to implement depth-first search (DFS) on a graph data structure and analyze its time complexity. The student defines a Graph class with functions to add edges between vertices and perform DFS recursively. In main(), a graph with 4 vertices and 4 edges is created and DFS is called starting at vertex 2, printing the traversal order 2 1 0 3.
This lab assignment asks the student to implement depth-first search (DFS) on a graph data structure and analyze its time complexity. The student defines a Graph class with functions to add edges between vertices and perform DFS recursively. In main(), a graph with 4 vertices and 4 edges is created and DFS is called starting at vertex 2, printing the traversal order 2 1 0 3.
This lab assignment asks the student to implement depth-first search (DFS) on a graph data structure and analyze its time complexity. The student defines a Graph class with functions to add edges between vertices and perform DFS recursively. In main(), a graph with 4 vertices and 4 edges is created and DFS is called starting at vertex 2, printing the traversal order 2 1 0 3.