1
Answer

Array rotation problem

Abhishek

Abhishek

8y
860
1
There is an array,a[ ] of n elements and is rotated in circular right direction for k times.
m in any index of an element in that array i.e. <= <= n .

then to get that mth element 

FORMULA is
a[m] = a[ (( m - k ) % n + n ) % n ]
 
What is the logic behind that formula? 
Answers (1)