2.9k views
2 votes
The complexity of bfs and dfs

1 Answer

2 votes

Answer:

BFS uses Queue to find the shortest path. DFS uses Stack to find the shortest path. ... Time Complexity of BFS = O(V+E) where V is vertices and E is edges. Time Complexity of DFS is also O(V+E) where V is vertices and E is edges.

Step-by-step explanation:

User Muradm
by
4.1k points