if v is the number of vertices and e is the number of edges, the time complexity of dfs using adjacency list structure is
Answers
Answered by
0
For a directed graph, the sum of the sizes of the adjacency lists of all the nodes is E (total number of edges). So, the complexity of DFS is O(V) + O(E) = O(V + E). For an undirected graph, each edge will appear twice. Once in the adjacency list of either end of the edge.
I hope this will help you
If helpful then please select my answer as brainliest answer
And also follow me ❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️
Similar questions