edited by
744 views

1 Answer

0 votes
0 votes
The space complexity is the extra amount of space excluding the input array or space. We are comparing the nature of algorithm in different situations. So we does not take input space into consideration as all the algorithm will be needing that as compulsary.

the extra space for bfs will be n as the queue may be maximum size of all the nodes .

Related questions

0 votes
0 votes
1 answer
1
Subbu. asked Jul 16, 2022
324 views
Please list the problems where BFS alone can do and DFS alone can do and both can do??
1 votes
1 votes
2 answers
2
saptarshiDey asked Feb 1, 2019
819 views
What will be the path from A-H if BFS is used in the following graph?