Question: The recursive method reverse() will NOT CHANGE ANYTHING IN THE ORIGINAL/PASSED ARRAY. reverse() returns an array with the passed array elements reversed. Here is a

The recursive method reverse() will NOT CHANGE ANYTHING IN THE ORIGINAL/PASSED ARRAY. reverse() returns an array with the passed array elements reversed. Here is a brief description of what you can do to recursively reverse the passed array. The method will copy the first element of the passed array into the last slot of a new array we are building to hold the reverse of the passed array, and copy the last element of the passed array into the first slot of the new array.

Then copy the entire middle elements of the passed array into another new array (you need to dynamically create this new array based on the size/number of the middle elements) and recursively reverse these middle elements in this new array. After the recursive call to reverse the middle elements, copy the reversed middle elements that was returned by the recursive call into the middle section of the new reversed array being built. In the end, return this new array that now has all the elements of the passed array reversed. Set up the Base Case(s) and Recursive Case(s). ArrayLists or other Collection lists are NOT allowed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!