retagged by
2,733 views
2 2 votes

Suppose prim’s algorithm is implemented using array as queue for a graph $G(V,E)$. Then what is the time complexity of Prim’s algorithm?

  1. $O (E \hspace{0.1cm}log\hspace{0.1cm} V)$
  2. $O (V^2 \hspace{0.1cm}log\hspace{0.1cm} V)$
  3. $O(V^2)$
  4. $O(VE)$

2 Answers

Best answer
2 2 votes
If we use min heap to implement prims algorithm time complexity is: O(E log V)

without using min heap time complexity is: O$\left ( V^{2} \right )$

so answer would be option C.O$\left ( V^{2} \right )$
selected by
0 0 votes
  • if we are implement prims using array then We use a boolean array  to represent the set of vertices included in MST. so this implementation is done by adjacency matrix and time complexity become o(v^2).
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.8k
1.8k views
Alakhator asked Oct 11, 2018
1,751 views
What is the time complexity of Prim algorithm without using min heap?
1 1 vote
0 0 answers
1.4k
1.4k views
Shivam Chauhan asked Nov 2, 2017
1,382 views
First statement is False because complexity will be O(E2).I think the second statement is true? But not sure
3 3 votes
1 1 answer
2.9k
2.9k views
pC asked Sep 22, 2017
2,927 views
Explain Prims AlgorithmAnalysis Of Time ComplexityHow does $\mathcal{O}(VlogV + ElogV)=\mathcal{O}(ElogV)$
0 0 votes
1 1 answer
1.1k
1.1k views
anonymous asked Jun 26, 2016
1,092 views