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,19 @@
fun bubbleSort ← void by List list
logic hasChanges ← true
int itemCount ← list.length
while hasChanges
hasChanges ← false
--itemCount
for int index ← 0; index < itemCount; ++index
if list[index] ≤ list[index + 1] do continue end
list.swap(index, index + 1)
hasChanges ← true
end
end
end
for each List sample in List[ int[3, 7, 3, 2, 1, -4, 10, 12, 4],
int[4, 65, 2, -31, 0, 99, 2, 83, 782, 1], int[7, 5, 2, 6, 1, 4, 2, 6, 3] ]
writeLine("Before: ", sample)
bubbleSort(sample)
writeLine("After: ", sample, "\n")
end