import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Random; public class Day30 { static int partition(int[] array, int low, int high) { int j, temp, i = low + 1; Random random = new Random(); int x = random.nextInt(high - low) + low; temp = array[low]; array[low] = array[x]; array[x] = temp; for (j = low + 1; j <= high; j++) { if (array[j] <= array[low] && j != i) { temp = array[j]; array[j] = array[i]; array[i++] = temp; } else if (array[j] <= array[low]) { i++; } } temp = array[i - 1]; array[i - 1] = array[low]; array[low] = temp; return i - 1; } static void Day30(int[] array,int low,int high){ if(low
Оригинал: “https://dev.to/mattryanmtl/day-30-quick-sort-2gmg”