/* quicksort */ static void qsort(int[] a, int l, int r){ if(l < r){ int i = l; int j = r; int x = a[(i+j)/2]; do{ while(a[i]x) j--; if(i<=j) { swap(a,i,j); i++; j--; } }while(i<=j); qsort(a,l,j); qsort(a,i,r); } } static void swap(int[] a, int s, int t){ int temp = a[s]; a[s] = a[t]; a[t] = temp; return; }