Hi I need to write a method that will rotate the elemnts in an array by a factor of k. ie shift each element k places to the right.
Here is the question i have been set
In the class ArrayLinearList a linear list is represented in an one-dimensional array element. The data member size is such that the list elements are in positions 0 through size-1 of the array. Write a new method rotate that will rotate the elements of the linear list k positions to the right. For example, if the list element[0:5] = [1, 2, 3, 4, 5, 6] is rotated by k=3, the result is [4, 5, 6, 1, 2, 3].
I've tried by inserting an element once i've shifted the elements one place to the right but I'm sure that this is incorrect. If anyone can be of any help I will be very grateful.