Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -0,0 +1,33 @@
|
|||
dim A(18)
|
||||
[initArray]
|
||||
for i = 0 to 18
|
||||
A(i) = int(rnd(1)*98)+1
|
||||
next i
|
||||
print "unsort: ";
|
||||
gosub [writeArray]
|
||||
gosub [gnomeSort]
|
||||
print " sort: ";
|
||||
gosub [writeArray]
|
||||
end
|
||||
|
||||
[writeArray]
|
||||
for i = 0 to 18
|
||||
print A(i); " ";
|
||||
next i
|
||||
print
|
||||
return
|
||||
|
||||
[gnomeSort]
|
||||
i = 1
|
||||
j = i+1
|
||||
while i <= 18
|
||||
if A(i-1) <= A(i) then
|
||||
i = j
|
||||
j = j+1
|
||||
else
|
||||
t = A(i-1) : A(i-1) = A(i) : A(i) = t
|
||||
i = i-1
|
||||
if i = 0 then i = j : j = j+1
|
||||
end if
|
||||
wend
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue