Question: 8. in method 3 in DSS we used array of heights and merging of the trees is accomplished by this array ( we merged the

8. in method 3 in DSS we used array of heights and merging of the trees is accomplished by this array ( we merged the lowest tree to the highest tree ).

Assuming that instead array of heights we will use array of size, that will save the number of nodes for each tree and the new merge will be accomplished by this array of size in the same way from the smallest tree to the biggest tree.

a. write merge3 function that will implement this method.

b. Can you block the height of the tree according to this approach?

c. what is the complexity of merge3 in this approach ?

Defined functions:

Merge3(a,b) {

If(height[a] = height[b]){

T[b] = a;

Height[a]++;

}

Else if ( height[a] > height[b]){

T[b] = a;

}

Else{

t[a] = b;

}

}

Find3(x) {

K = x;

While ( k != t[k] ) {

K = t[k];

}

Return k;

}

Merge4 ( a,b) {

If ( a > b ) {

T[a] = b;

}

Else{

T[b] = a;

}

}

Find4(x) {

K = x;

While(t[k] !=k ){

K = t[k];

}

While( I != k ){

J = t[I];

I = j;

}

Return k;

}

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!