Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

algorithm number 3 plz 16 return maxLe maxRight left sum rightsum ft 17 FI (A, l

ID: 3823430 • Letter: A

Question

algorithm



number 3 plz

16 return maxLe maxRight left sum rightsum ft 17 FI (A, low, high) 18 if high low 19 return low high Allow] 20 else 21 mid floor (low-thigh) /2) 22 (leftLow, leftHigh,leftsum) Y (A,low ,mid) FINDMAXIMUMSUBARRA 23 (rightLow rightHigh Y (A, mid+1 ,high) highl 23 (crossLow, crossHigh crosssum) NDMAxcROSSINGSUBARRAY (A, low mad, 24 if ((leftsum rightsum) && (leftsum crosssum) return leftLow lefthigh. leftsum 26 el seif (rightsum 2 leftsum) &6 (rightsum 2 crosssum) return (right Low r right High right sum 28 else return cross Iow cross High Figure 1. Pseudo code for Maximum Subarray Algorithm (ref. CLRS pp 71-72)

Explanation / Answer

23 times

The function calls minmax recursively twice within the function itself and for n number of elements in the array , the comparison high == low will be done 2*n - 1 times.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote