public static int partition(int[] arr, int left, int right) {
while (arr[left] < pivot) {
while (arr[right] > pivot) {
public static void quickSort(int[] arr, int left, int right) {
pivot = partition(arr, left, right);
quickSort(arr, left, pivot - 1);
quickSort(arr, pivot + 1, right);
public static void print(int[] arr) {
for (int i = 0; i < arr.Length; i++) {
Console.Write(arr[i] + " ");
public static void Main()
int[] arr = {67, 12, 95, 56, 85, 1, 100, 23, 60, 9};
quickSort(arr, 0, arr.Length - 1);