Question: A directed graph is n vertices and e edges is given. Estimate the average time spent on a single call of the recursive version of
A directed graph is n vertices and e edges is given. Estimate the average time spent on a single call of the recursive version of dfs in terms of n and e. Assume that the graph is represented in terms of adjacency lists. Justify your answer.
for v := 1 to n do mark[v] := unvisited; for v := 1 to n do if mark[v] = unvisited then dfs(v)
procedure dfs(v: vertex); var w: vertex; begin mark[v] := visited; for each w in L[v] do if mark[w] = unvisited then dfs(w) end;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
