Question: Rewrite the MERGE procedure so that it does not use sentinels (infinite value ), instead stopping once either array L or R has had all
Rewrite the MERGE procedure so that it does not use sentinels (infinite value ), instead stopping once either array L or R has had all its elements copied back to A and then copying the remainder of the other array back into A.
MERGE (A, p, q, r) 3. Let LII...n, l] and RTI n2 ll be new arrays for i I to n 4. 6. for j l to n 8. LInl ij E oo Co marks the end of subarray 9. RIn2 ll oo Oo marks the end of subarray 10. i I l. j 12. for k p to r 13 I 4 I 5. i I 6 else I 7 l 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
