RotateList.java 491B

12345678910111213
  1. /**
  2. * Finish the class RotateList make it subclasse the built-in List class. (Hint extends ?????)
  3. * Write a function that rotates a list by k elements.
  4. * For example [1,2,3,4,5,6] rotated by 2 becomes [3,4,5,6,1,2].
  5. * The first 2 elements where rotated to the back of the List.
  6. * If it was rotated by 3 [1,2,3,4,5,6] rotated becomes [4,5,6,1,2,3].
  7. * Try solving this without creating a copy of the list.
  8. * How many swap or move operations do you need?
  9. */
  10. public class RotateList{
  11. }