1.

An array A consists of n integers in locations A[0], A[1]…. A[n-1]. It is required to shift the elements of the array cyclically to the left by k places, where 1 < = k < = (n-1). An incomplete algorithm for doing this in linear time, without using another array is given below Complete the algorithm by filling in the blanks. Assume alt the variables are suitably declared.min = n; i = 0;while (____________){ temp = A[i] ; j = i; while(______________){A[j] = ________;j = (j + k)mod n;If(j < k)mod n; min = j;}A[(n + i – k)mod n] = _______;i = ________;}

A. i>min; j! = (n+i)mod n; A[j+k]; temp; i+1;
B. i< b>
C. i>min; j! = (n+i+k)mod n; A[j+k]; temp; i+1;
D. i< b>
Answer» E.


Discussion

No Comment Found