dfs and bfs runtime code example
Example: dfs runtime
O(# of node visits + # of edge scans)
incur |V| time steps, plus the time incurred to visit adjacent nodes (essentially, these form an edge, and we have a total of |E| edges, hence,
O(# of node visits + # of edge scans)
incur |V| time steps, plus the time incurred to visit adjacent nodes (essentially, these form an edge, and we have a total of |E| edges, hence,