package SortingAlgorithm; import java.util.Arrays; public class QuickSort { public static void main(String[] args) { int[] array = {9,4,6,8,3,10,4,6}; quicksort(array,0,array.length-1); System.out.println(Arrays.toString(array)); } public static void quicksort(int[] array,int low,int high){ if(low>=high)return; int left = low; int right = high; int p = array[low]; while(left<right){ while(array[right]>=p&&left<right){ right--; } while(array[left]<=p&&left<right){ left++; } int temp = array[right]; array[right]=array[left]; array[left]=temp; } array[low]=array[left]; array[left]=p; quicksort(array,low,right-1); quicksort(array,right+1,high); } }