Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
Array rotation problem
Abhi Shek
7y
335
1
Reply
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.
0
<=
m
<=
n
.
then to get that
m
th
element
FORMULA is
a[m] = a[ (( m - k ) % n + n ) % n ]
What is the logic behind that formula?
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Emoticons do not work on C# Corner
Images In Blog not Showing Properly