An array A consists of n integers in locations A[O], A[1] ....A[n-1]. It is required to shift the elements of the array cyclically to the left by k places, where $$1 \leq k \leq (n-1)$$. An incomplete algorithm for doing this in linear time, without using another array is given below. Complete the algorithm byfilling 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 < min) then
min = j ;
}
A[(n + i - k) mod n] = .............;
i = ...........;
}
Create a FREE account and get: