import java.util.Scanner; /** * Implementation of QuickSort * * @author Unknown * */ public class Quicksort{ /** * The main method * * @param args Command line arguments */ public static void main(String[] args){ Scanner input = new Scanner(System.in); int[] array; int size = 0; //Prompt user to create array and its elements System.out.print("Enter the size of the array: "); size = input.nextInt(); array = new int[size]; for (int i = 0; i < size; i++){ System.out.print("For index " + i + ", give an integer input: "); array[i] = input.nextInt(); } //Output inputted array System.out.println("The array is: "); printarray(array); System.out.println(); //Run quicksort, and output sorted array quicksort(array, 0, array.length - 1); System.out.println("The sorted array is: "); printarray(array); System.out.println(); input.close(); } /** * QuickSort method * * @param ar Array to perform QuickSort * @param start Start of the array * @param end End of the array */ public static void quicksort(int[] ar, int start, int end){ int[] array; int i = start, j = end; if (end-start >= 1){ int pivot = ar[end]; while (i< j){ while (ar[i]=pivot && j>start){ j--; } if (i