Write a method called wrapHalf that accepts a linked list of integers as a parameter and moves

Question:

Write a method called wrapHalf that accepts a linked list of integers as a parameter and moves the first half of the list to the back of the list. If the list contains an odd number of elements, the smaller half is wrapped (in other words, for a list of size N, the middle element, N/2, becomes the first element in all cases). For example, calling wrapHalf on the list [1, 2, 3, 4, 5, 6] , would change that list into [4, 5, 6, 1, 2, 3] . For the list [5, 6, 7, 8, 9], the result would be [7, 8, 9, 5, 6].

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: