Undirected graph is given with the list of edges. First line contains number of vertices. Each next line contains an edg
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Undirected graph is given with the list of edges. First line contains number of vertices. Each next line contains an edg
Undirected graph is given with the list of edges. First line contains number of vertices. Each next line contains an edge. Run Depth First Search (DFS) from the specified vertex. Print the last visited vertex during DFS. Input The first line contains number of vertices n. Next lines contains list of edges (read till the end of file). Output Run Depth First Search (DFS) from the vertex 5. Print the last visited vertex during DFS. Sample input 5 13 23 25 Sample output 1