Skip to content

Instantly share code, notes, and snippets.

@vaskoz
Created February 15, 2013 06:42
Show Gist options
  • Save vaskoz/4958867 to your computer and use it in GitHub Desktop.
Save vaskoz/4958867 to your computer and use it in GitHub Desktop.
Thresholds of DualPivotQuicksort
/**
* If the length of an array to be sorted is less than this
* constant, Quicksort is used in preference to merge sort.
*/
private static final int QUICKSORT_THRESHOLD = 286;
/**
* If the length of an array to be sorted is less than this
* constant, insertion sort is used in preference to Quicksort.
*/
private static final int INSERTION_SORT_THRESHOLD = 47;
/**
* If the length of a byte array to be sorted is greater than this
* constant, counting sort is used in preference to insertion sort.
*/
private static final int COUNTING_SORT_THRESHOLD_FOR_BYTE = 29;
/**
* If the length of a short or char array to be sorted is greater
* than this constant, counting sort is used in preference to Quicksort.
*/
private static final int COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR = 3200;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment