Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

(1 point) Calculate 3 sin x cos x dx.

Answered: 1 week ago

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago