static void swap(int[] arr, int i, int j)
static int partition(int[] arr, int low, int high)
for (int j = low; j <= high - 1; j++)
static void quickSort(int[] arr, int low, int high)
int pi = partition(arr, low, high);
quickSort(arr, low, pi - 1);
quickSort(arr, pi + 1, high);
static void printArray(int[] arr, int size)
for (int i = 0; i < size; i++)
Console.Write(arr[i] + " ");
public static void Main()
int[] arr = { 10, 7, 8, 9, 1, 5 };
quickSort(arr, 0, n - 1);
Console.Write("Sorted array: ");