Question: If image is too small please zoom in Consider the pseudocode below. ALGORITHM - SUM(A, n) sum = 0 for i = n down to
If image is too small please zoom in

Consider the pseudocode below. ALGORITHM - SUM(A, n) sum = 0 for i = n down to 1 sum = sum + A[l] return sum Which of the following is the correct loop invariant for the for loop? At the start of each iteration i of the for loop. Sum contains the sum of all the elements in the subarray A[I + 1..]. At the start of each iteration i of the for loop, sum contains the sum of all the elements in the subarray A[1..i + 1] At the start of each iteration i of the for loop, sum contains the sum of all the elements in the subarray A[1..i]. At the start of each iteration i of the for loop, sum contains the sum of all the elements in the subarray A[i..n]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
