Question: Part 1: public static void displayArray(int array[], int first, int last) { if (first == last) System.out.print(array[first] + ); else { int mid =
Part 1:
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 } // end displayArray
Suppose that the arrays middle element is not in either half of the array. Instead you can recursively display the left half, display the middle element, and then recursively display the right half. What is the implementation of displayArray if you make these changes?
Part 2:
Implement the changed array in Java pseudocode and then analyze the algorithm in Big-Oh notation.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
