...
Question 11088 – Algorithms
November 19, 2023
Question 9180 – B-Trees
November 19, 2023
Question 11088 – Algorithms
November 19, 2023
Question 9180 – B-Trees
November 19, 2023

Question 10311 – Algorithms

An array A contains 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 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:="____________;" 

Correct Answer: A

A
Theory Explanation.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!