Class ArrayReverse

java.lang.Object
com.zybooks.dsaj.recursion.ArrayReverse

public class ArrayReverse extends Object
Demonstration of recursive method for reversing an array's elements.
  • Constructor Details

    • ArrayReverse

      public ArrayReverse()
  • Method Details

    • reverseArray

      public static void reverseArray(int[] data, int low, int high)
      Reverses the contents of subarray data[low] through data[high] inclusive.
      Parameters:
      data - an array of integers
      low - the index of the first element in the range to be reversed
      high - the index of the last element in the range to be reversed
    • reverseIterative

      public static void reverseIterative(int[] data)
      Reverses the contents of the given array.
      Parameters:
      data - an array of integers