public class sort {
public void sort(int arr) {
shuffle(arr);
sort(arr, 0, arr.length);
}
private void sort(int[] arr, int lo, int hi) {
if(lo >= hi) return;
int j = partition(arr, lo, hi);
sort(arr, lo, j - 1);
sort(arr, j + 1; hi);
}
private int partition(int[] arr, int lo, int hi) {
int v = arr[lo];
int i = lo, j = hi + 1;
while(true) {
while(arr[++i] < v) if(i >= hi) break;
while(arr[--j] > v) if(j <= lo) break;
if(i >=j) break;
exch(arr, i, j);
}
exch(arr, lo, j);
return j;
}
private void exch(int[] arr, int i, int j) {
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
private void shuffle(int[] arr) {
}
}
public void sort(int arr) {
shuffle(arr);
sort(arr, 0, arr.length);
}
private void sort(int[] arr, int lo, int hi) {
if(lo >= hi) return;
int j = partition(arr, lo, hi);
sort(arr, lo, j - 1);
sort(arr, j + 1; hi);
}
private int partition(int[] arr, int lo, int hi) {
int v = arr[lo];
int i = lo, j = hi + 1;
while(true) {
while(arr[++i] < v) if(i >= hi) break;
while(arr[--j] > v) if(j <= lo) break;
if(i >=j) break;
exch(arr, i, j);
}
exch(arr, lo, j);
return j;
}
private void exch(int[] arr, int i, int j) {
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
private void shuffle(int[] arr) {
}
}