eng
competition

Text Practice Mode

Practice for programming

created Sep 21st 2020, 02:27 by SamehEtman


6


Rating

94 words
19 completed
00:00
function sort(array, less) {  
function swap(i, j) {
 var t = array[i]; array[i] = array[j]; array[j] = t; }
 function quicksort(left, right) { if (left < right) { var pivot = array[left + Math.floor((right - left) / 2)], left_new = left, right_new = right;  
do { while (less(array[left_new], pivot)) { left_new += 1; }  
while (less(pivot, array[right_new])) { right_new -= 1; }  
if (left_new <= right_new) { swap(left_new, right_new); left_new += 1; right_new -= 1; } }
 while (left_new <= right_new); quicksort(left, right_new); quicksort(left_new, right); } } quicksort(0, array.length - 1); return array; }

saving score / loading statistics ...