Q7
NATMarks unknownAn array contains integers in locations . It is required to shift the elements of the array cyclically to the left by places, where . 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 all variables are suitably declared. min:=n; i=0; while _____ do begin temp:=A[i]; j:=i; while ____ do begin A[j]:=____; j:=(j+K) mod n; if j<min then min:=j; end; A[(n+i-K)mod n]:=____; i:=______; end;
Sign in to save attempts.
Loading…