private static int partition(int[] arr, int low, int high)
int pivot = arr[(low + high) / 2];
} while (arr[left] < pivot);
} while (arr[right] > pivot);
if (left >= right) return right;
private static void quickSort(int[] arr, int low, int high)
int pivot = partition(arr, low, high);
quickSort(arr, low, pivot);
quickSort(arr, pivot+1, high);
private 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};
Console.WriteLine("Quick Sorted Array...");