

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Total Marks = 20
Your assignment must be uploaded / submitted before or on July 04, 2012
Please view the assignment submission process document provided to you by the Virtual University.
Please note that your assignment will not be graded if:
Note: Material that is an exact copy from handouts or internet would be graded Zero marks. Your solution should consist of the material found through different sources and written in your own words.
Suppose that all edge weights in a graph are integers in the range from 1 to | V |. How fast can you make Kruskal's algorithm run? What if the edge weights are integers in the range from 1 to W for some constant W****?
We know that Kruskal.s algorithm takes O(V) time for initialization, O(E lg E) time to sort the edges, and O(E ฮฑ(V)) time for the disjoint-set operations, for a total running time of O(V + E lg E + E ฮฑ(V)) = O(E lg E)****.
If we knew that all of the edge weights in the graph were integers in the range from 1 to | V |, then we could sort the edges in O(V + E) time using counting sort. Since the graph is connected, V = O(E) , and so the sorting time is reduced to
O(E)****. This would yield a total running time of O(V + E + E ฮฑ(V)) = O(E ฮฑ(V)) , again since V = O(E) , and since E = O(E ฮฑ(V))****. The time to process the edges, not the time to sort them, is now the dominant term. Knowledge about the weights won.t help speed up any other part of the algorithm, since nothing besides the sort uses the weight values.
If the edge weights were integers in the range from 1 to W for some constant W , then we could again use counting sort to sort the edges more quickly. This time, sorting would take O(E + W) = O(E) time, since W is a constant. As in the first part, we get a total running time of O(E ฮฑ(V))****.