Question: 2 . Consider the following divide - and - conquer algorithm: float myFunc ( X ) { n = X . length; if ( n

2. Consider the following divide-and-conquer algorithm: float myFunc(X){ n = X.length; if (n ==1){ return X[0]; }// let X1, X2 be arrays of size n/2 for (i =0; i !=(n/2)-1; i++){ X1[i]= X[i]; X2[i]= X[n/2+ i]; } for (i =0; i !=(n/2)-1; i++){ for (j =0; j !=(n/2)-1; j++){ if (X1[i]== X2[j]){ X2[j]=0; }}} r1= myFunc(X1); r2= myFunc(X2); return max(r1, r2); }(a) Obtain a recurrence relation for the algorithms basic operation count. (b) Solve the recurrence relation found in part (a) t

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 Programming Questions!