I haven't found anything with the specific needs of my function to do this, yes, it is for homework.
So I have:
public void reverseArray(int[] x) {
}
Precondition: x.length > 0
The fact that I can't have the function return anything, and the only argument is an array is leaving me stumped.
I've tried using loops along with the recursion, but everything I've tried seems to end up with infinite instances of the function being made.
I've gotten an idea/suggestion to use another function along with this one, but, how to use the original recursively is beyond me at the moment.
Any help is appreciated.
Since there's been no statement that loops cannot be used:
Probably the fastest of the lot.
}
psuedo code
This is probably the easiest way, not the fastest, but probably the easiest.
A whole program would look something like this:
Hope it helps!