Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -1,23 +1,23 @@
swap := proc(arr, a, b)
local temp := arr[a];
arr[a] := arr[b];
arr[b] := temp;
local temp := arr[a];
arr[a] := arr[b];
arr[b] := temp;
end proc:
stoogesort:= proc(arr, start_index, end_index)
local cur;
if (arr[end_index] < arr[start_index]) then
swap(arr, start_index, end_index);
end if;
if end_index - start_index > 1 then
cur := trunc((end_index - start_index + 1)/3);
stoogesort(arr, start_index, end_index - cur);
stoogesort(arr, start_index + cur, end_index);
stoogesort(arr, start_index, end_index - cur);
end if;
return arr;
local cur;
if (arr[end_index] < arr[start_index]) then
swap(arr, start_index, end_index);
end if;
if end_index - start_index > 1 then
cur := trunc((end_index - start_index + 1)/3);
stoogesort(arr, start_index, end_index - cur);
stoogesort(arr, start_index + cur, end_index);
stoogesort(arr, start_index, end_index - cur);
end if;
return arr;
end proc: