retagged by
490 views
1 votes
1 votes

The least running time of creating spanning tree from connected graph  in G(E, V) is 

  1. O (V log V) 
  2. O (E + V log V)
  3. O (E log V)    
  4. O (V log V + E log V)
    Where E, V are respectively number of edges & vertices in the graph. 
retagged by

2 Answers

0 votes
0 votes
Though, I feel the question contains insufficient details but still.

The prims algorithm is used when the graph is dense or the number of edges is very high as compared to the number of vertices.

Kruskal is better to be used when the graph is sparse.

Now, coming to the worst case time complexities of both the algorithms.

$PRIMS$ $:$ $O(E + VlogV)$

$KRUSKAL$: $O(ELOGV)$

Since, both of these options are given in the question, then I would chose the Kruskal since, it uses much more simpler data structures in its implementation.

$Kruskal$: Implemented by Union-Find.

$Prims$: Implemented by Fibonacci Heap.

So, answer is (C) according to me.
............................................................................................................
$Note:$ Prims can't be used for disconnected graphs unlike Kruskal.
edited by
0 votes
0 votes

For kruskal the time complexity is O (E log V)   and its least. Hence option C is the answer

Answer:

Related questions

43 votes
43 votes
3 answers
1
Kathleen asked Sep 12, 2014
13,911 views
Kruskal’s algorithm for finding a minimum spanning tree of a weighted graph $G$ with $n$ vertices and $m$ edges has the time complexity of:$O(n^{2})$$O(mn)$$O(m+n)$$O(m...
0 votes
0 votes
0 answers
3
gatecse asked Aug 4, 2019
207 views
The running time of an algorithm of n interdependent operations is computed with both the asymptotic & amortized analyses. The most accurate running time obtained by Asy...
0 votes
0 votes
0 answers
4