Question: You are given a graph that has 9 nodes, numbered 1 to 9 , and the following edges in sorted order by weight: ( 2

You are given a graph that has 9 nodes, numbered 1 to 9, and the following edges in sorted order by weight:
(2,9),(1,3),(4,6),(2,8),(3,6),(5,6),(3,4),(2,7),(7,9),(1,6),(4,5).
Run Kruskal's algorithm using a union-find array and update that array by processing the edges in the order received. When merging union-find "trees", connect the representative (root) of the lighter tree (the one with the smaller number of nodes) to the heavier tree (the one with the larger number of nodes). If the two trees have the same number of nodes, then connect the representative node with the larger value/index to the one with the smaller value/index.
Representative nodes will have initial values of '0', meaning that every entry in the union-find array will be initialized to zero. Write below the contents of the union-find array once all edges have been processed.
How many connected components does the graph have?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!