Question: * PROBLEM 2: Do the same translation for this in-place reverse function */ public static void reverseI (double[] a) { int hi = a.length -
* PROBLEM 2: Do the same translation for this in-place reverse function
*/
public static void reverseI (double[] a) {
int hi = a.length - 1;
int lo = 0;
while (lo < hi) {
double loVal = a[lo];
double hiVal = a[hi];
a[hi] = loVal;
a[lo] = hiVal;
lo = lo + 1;
hi = hi - 1;
}
}
public static void reverse (double[] a) {
// TODO
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
