29.08.2016, 11:44
This function:
Can sort float numbers?
Code:
stock quickSort(array[], left=0, right) { new tempLeft = left, tempRight = right, pivot = array[(left + right) / 2], tempVar ; while(tempLeft <= tempRight) { while(array[tempLeft] < pivot) tempLeft++; while(array[tempRight] > pivot) tempRight--; if(tempLeft <= tempRight) { tempVar = array[tempLeft], array[tempLeft] = array[tempRight], array[tempRight] = tempVar; tempLeft++, tempRight--; } } if(left < tempRight) quickSort(array, left, tempRight); if(tempLeft < right) quickSort(array, tempLeft, right); }