954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

What is meant by rotating an array?

Hello All,

I came across a question wherein I need to find an element in the array.However, it's given that the array has been rotated many number of times and initially the array elements were sorted in an increasing order.I just wanted to know what is meant by rotating an array? Does it mean simply changing order of the elements or it implies something else? I know this might be a stupid question to ask.

Thanks.

ChPravin
Light Poster
49 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

I assume it means shifting all the elements one place to the right with the last element in the array wrapping around to be the first element in the array with every rotation.

aspire1
Light Poster
43 posts since Apr 2010
Reputation Points: 46
Solved Threads: 14
 

When I use the term, it means what aspire1 said, except that you can shift the elements N places, for some value of N.

Either way, "many rotations" gets the same meaning, and the combined effect of many rotations is the same as that of one of rotation, or a small number of aspire1's variety.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

Initial array is 1,2,3,4,5,6,7,8,9,10
After rotating it 3 times 8,9,10,1,2,3,4,5,6,7

abhimanipal
Master Poster
742 posts since Dec 2009
Reputation Points: 114
Solved Threads: 104
 

Thanks for the replies.

ChPravin
Light Poster
49 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You