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

@ -4,38 +4,38 @@ dim array(15)
a = array[?,]
b = array[?]
for i = a to b
array[i] = int(rand * 100)
array[i] = int(rand * 100)
next i
print "unsort ";
for i = a to b
print rjust(array[i], 4);
print rjust(array[i], 4);
next i
call gnomeSort(array)
print chr(10); " sort ";
for i = a to b
print rjust(array[i], 4);
print rjust(array[i], 4);
next i
end
subroutine gnomeSort (array)
i = array[?,] + 1
j = i + 1
while i <= array[?]
if array[i - 1] <= array[i] then
i = j
j += 1
else
temp = array[i - 1]
array[i - 1] = array[i]
array[i] = temp
i -= 1
if i = array[?,] then
i = j
j += 1
end if
end if
end while
i = array[?,] + 1
j = i + 1
while i <= array[?]
if array[i - 1] <= array[i] then
i = j
j += 1
else
temp = array[i - 1]
array[i - 1] = array[i]
array[i] = temp
i -= 1
if i = array[?,] then
i = j
j += 1
end if
end if
end while
end subroutine