Question: Write a recursive method that has as arguments an array of characters and two bounds on array indexes. The method should reverse the order of
Write a recursive method that has as arguments an array of characters and two bounds on array indexes. The method should reverse the order of those entries in the array whose indexes are between the two bounds (inclusive). For example, suppose the array is:
a[0] = 'A' a[1] = 'B' a[2] = 'C'
a[3] = 'D' a[4] = 'E'
and the bounds are 1 and 4. Then, after the method
is run, the array elements should be:
a[0] = 'A' a[1] = 'E' a[2] = 'D'
a[3] = āCā a[4] = 'B'
Embed the method in a program and test it.
Step by Step Solution
3.40 Rating (153 Votes )
There are 3 Steps involved in it
Heres an example implementation of the method in Java public static void reverseArraychar ... View full answer
Get step-by-step solutions from verified subject matter experts
