Question: Consider CONNECTED-COMPONENTS algorithm. Let G = (V, E) be the input graph, n = |V|, m = |E|, k = the # of connected components

Consider CONNECTED-COMPONENTS algorithm. Let G = (V, E) be the input graph, n = |V|, m = |E|, k = the # of connected components of G.

CONNECTED-COMPONENTS (G) algorithm

for each vertex Consider CONNECTED-COMPONENTS algorithm. Let G = (V, E) be the input graph, {

MAKE-SET(v) }

for each edge (u,v) n = |V|, m = |E|, k = the # of connected {

if FIND_SET(u) != FIND-SET(v){

UNION(u,v) }

}

a. Determine and express the exact # of times Union is called in terms of n and k.

b. Presume that Make-Set, Find-Set, Union are implemented by forests with rank and path compression. Analyze the runtime efficiency of CONNECTED-COMPONENTS and express it in O( ) notation; use the result of question (a) and Theorem 21.14 on page 581.

c. Modify CONNECTED-COMPONENTS so that it will also compute the set of edges in a spanning forest of G. A spanning forest of G is a set of spanning trees of the connected components of G.

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!