Source of 7.45.java


  1: public void displayArray(int first, int last)
  2: {
  3:    if (first == last)
  4:       System.out.print(array[first] + " ");
  5:    else 
  6:    {
  7:       int mid = first + (last - first) / 2; // Improved calculation of midpoint
  8:       displayArray(first, mid);
  9:       displayArray(mid + 1, last);
 10:    } // end if
 11: } // end displayArray
 12: // Version 4.0