public static void displayArray(int array[], int first, int last) {
if (first == last)
System.out.print(array[first] + " ");
else {
int mid = (first + last) / 2;
displayArray(array, first, mid);
displayArray(array, mid + 1, last);
} // end if
}
-Can anyone please explain to me how this method is working. I know that it prints the elements in the array, but I am confused how since there is a no print statement in the recursive case.
array = { 1, 3, 7 }, first = 0, last = 2, then follow the logic and write down what the 2 recursive calls will be. Then for each of those, repeat it.