User:Gadren/java

int comparisons = 0; if(end-start < 1) return comparisons; int middle = (start + end)/2; if(list.get(middle).compareTo(list.get(start))< 0) swapReferences(list, start, middle); if(list.get(end).compareTo(list.get(start)) < 0) swapReferences(list, start, end); if(list.get(end).compareTo(list.get(middle)) < 0) swapReferences(list, middle, end); if(end-start<2) return comparisons; swapReferences(list, middle, end-1); E pivot = list.get(end-1); int i, j;           for(i = start, j= end-1; ;) {               while(i < end-1 && list.get(i++).compareTo(pivot)< 0) {} while(j > 0 && pivot.compareTo(list.get(j--))< 0) {} if(i >= j)                   break; swapReferences(list, i, j); }           swapReferences(list, i, end-1); quicksortWithoutCutoff(list, start, i -1); quicksortWithoutCutoff(list, i + 1, end); return comparisons; }