We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 60cd296 commit 58342dfCopy full SHA for 58342df
Graphs/graphs_bfs.go
@@ -18,6 +18,10 @@
18
vertices and E is the number of edges in the graph. This is because BFS traverses all the vertices
19
and edges of the graph exactly once, and the time taken to visit each vertex and edge is constant.
20
Therefore, the time complexity of BFS is proportional to the size of the graph.
21
+
22
+ The space complexity of BFS is O(|V|), where |V| is the number of vertices in the graph.
23
+ This is because in the worst case scenario, we would need to store all vertices in the queue
24
+ before we finish traversing the graph.
25
*/
26
package main
27
0 commit comments