Question: Hi, I need some help with this question. Below is the MERGE procedure from the Merge sort algorithm: 1. n1-q-p+1 2, n2=r-q 3. let L[1.n1+1]
Hi, I need some help with this question.

Below is the MERGE procedure from the Merge sort algorithm: 1. n1-q-p+1 2, n2=r-q 3. let L[1.n1+1] and R[1..n2+1] be new arrays 4, for i 1 to n! 6, for j = 1 to n2 8, L[n1+1) = oo 9. R[nat11-00 10.i 1 11.j 1 12, for k = p to r 13. if LilRli 14 15 16. else A[k]=R[j] 17 Which of the following is the correct loop invariant for the for loop in lines 12..17? At the start of each iteration i of the for loop, the subarray Alp.r] contains the (i-p) smallest elements of Alp.r] in sorted order At the start of each iteration k of the for loop, the subarray Al1.k] contains the k smallest elements of A in sorted order At the start of each iteration k of the for loop, the subarray Alk. contains the (r-k+1) largest elements of Ap.-r] in sorted order. At the start of each iteration k of the for loop, the subarray Ap.k-1] contains the (k-p) smallest elements of Ap.r] in sorted order
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
