• edited by
1,219 views
0 0 votes

1. Does space complexity includes both input space and extra space needed for algorithm or only extra space?

2.What will be Space complexity for BFS algorithm with adjacency matrix representation? Please reply with supporting references.

1 Answer

0 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 .
Position:
Show:

Related questions

0 0 votes
1 1 answer
684
684 views
Subbu. asked Jul 16, 2022
684 views
Please list the problems where BFS alone can do and DFS alone can do and both can do??
1 1 vote
2 2 answers
1.4k
1.4k views
saptarshiDey asked Feb 1, 2019
1,357 views
What will be the path from A-H if BFS is used in the following graph?
1 1 vote
0 0 answers
1.8k
1.8k views
Markzuck asked Dec 30, 2018
1,843 views
Can someone please explain what are the types of edges possible in BFS and DFS for DIRECTED as well as UNDIRECTED graphs?Individual meaning of BACK, FRONT and CROSS edges...
0 0 votes
1 answers 1 answer
3.3k
3.3k views
Sandy Sharma asked Dec 25, 2018
3,273 views
True or False , with reason.For a directed graph, the absence of back edges with respect to a BFS tree implies that the graph is acyclic?Answer is FalseExplanation:FALSE....