• edited by
3,853 views

1 Answer

Best answer
6 6 votes

In this scenario kruskal's algorithm will run faster than prim's. The time complexity of kruskal's algorithm is

O(E log E) <--(time taken to sort E edges)      +    (E α(V)) <--  find set and union operations

Given that edge weights are uniformly distributed over half open interval [0,1), we can sort the edge list in O(E) time using bucket sort (see CLRS Bucket sort). 

So now the running time of kruskal's MST algorithm will become

O(E) + (E α(V))

where α(V) is the inverse ackermann function whose value is less than 5 for any practical input size 'n'. (ref wiki)

so, the running time of kruskal's MST algorithm is linear, where prim's will still work in O((V+E)log V)

• selected by
Position:
Show:

Related questions

1 1 vote
1 answers 1 answer
1.2k
1.2k views
Debargha Mitra Roy asked Aug 25, 2024
1,237 views
Which of the statement is/are correct?(a) First edge added by Kruskal’s algorithm can be the last edge added by prim’s algorithm(b) In a graph, if one raises the length o...
5 5 votes
1 1 answer
2.6k
2.6k views
sunil sarode asked Jan 2, 2018
2,553 views
Given graph using Prim’s or Kruskal’s algorithm, find out that how many distinct minimum cost spanning trees are possible___?My answer was 1 and given is 2 ,what I am mi...
2 2 votes
3 3 answers
2.5k
2.5k views
Geet asked Oct 26, 2016
2,494 views
Can Prim's and Kruskal's algorithm yield different minimum spanning trees? Explain why or why not.
3 3 votes
2 answers 2 answers
2.6k
2.6k views
DeadMann asked Jun 24, 2023
2,602 views
Can anyone help in solving the question 105 to 109.I don't have answer key I want to confirm my answer ...i will update my answer in the comments.