how to rotate the array from left and right side
Answers
Answered by
0
Answer:
In this method simply create a temporary array and copy the elements of the array arr[] from 0 to the (D-1)th index. After that move, the rest elements of the array arr[] from index D to N.
...
Explanation:
The initial array [1, 2, 3, 4, 5]
rotate by first index [2, 3, 4, 5, 1]
rotate by second index [3, 4, 5, 1, 2]
Similar questions