Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,15 @@
type StoogeSorter
fun stoogeSort ← void by List list, int i, int j
if list[j] < list[i] do list.swap(i, j) end
if j - i + 1 > 2
var t ← (j - i + 1) / 3
stoogeSort(list, i, j - t)
stoogeSort(list, i + t, j )
stoogeSort(list, i, j - t)
end
end
fun sort ← <List list|stoogeSort(list, 0, list.length - 1)
type Main
List sample ← int[1, 4, 5, 3, -6, 3, 7, 10, -2, -5, 7, 5, 9, -3, 7]
StoogeSorter.sort(sample)
writeLine(sample)