retagged by
315 views

3 Answers

Best answer
1 votes
1 votes

answer C) option 
suppose we have vertex of graph with 4 vertices so  we need 4 *4 ,matrix which will show that either edges is present in the graph or not if edge is present than mark it as 1 if no edge is present than put zero in that particular slot we need O(V2) 

still we need correction in option :)

selected by
1 votes
1 votes
Answer will be C : 0(N ^ 2 ).

because we are representing the graph in matrix which have number of rows  equals to number of columns = N ( Total nodes )

And also,  adjacency matrix were independent of edges,  it will always take O(N^2) space to represent graph as adjacency matrix,

either graph have no edges , few edges or any number of edges.
0 votes
0 votes

Answer is c : O (v2) because 

In graph, adjacency matrix were independent of edges. It will always takes O(v2) space required to store adjacency matrix. .

Related questions

4 votes
4 votes
1 answer
1
5 votes
5 votes
2 answers
2
Shivani gaikawad asked Aug 17, 2018
1,013 views
What is the space complexity of the following code?$O(logn)$ $O(n)$$O(nlogn)$ $O(1)$
0 votes
0 votes
1 answer
3
parulnabi asked Sep 2, 2016
582 views
Which of the following algorithm has the smallest memory requirement, including data space and run time stack for recursive calls?A. Insertion SortB. Quick SortC. Selecti...
0 votes
0 votes
1 answer
4
mehul vaidya asked Mar 31, 2018
285 views
is it true that space complexity is always less than equal to time complexity i.e. S(n) = O(T(n)) I think it is.