Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void qsort(int[] array, int begin, int end) {
- if (end > begin) {
- int index = begin + RAND.nextInt(end - begin + 1);
- int pivot = array[index];
- {
- int tmp = array[index];
- array[index] = array[end];
- array[end] = tmp;
- }
- for (int i = index = begin; i < end; ++i) {
- if (c.compareSuffixes(array[i], pivot) <= 0) {
- int tmp = array[index];
- array[index] = array[i];
- array[i] = tmp;
- index++;
- }
- }
- {
- int tmp = array[index];
- array[index] = array[end];
- array[end] = tmp;
- }
- System.out.println("Index : " + index);
- qsort(array, begin, index - 1);
- qsort(array, index + 1, end);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement