Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -0,0 +1,41 @@
|
|||
arraybase 1
|
||||
global array
|
||||
dim array(15)
|
||||
a = array[?,]
|
||||
b = array[?]
|
||||
for i = a to b
|
||||
array[i] = int(rand * 100)
|
||||
next i
|
||||
|
||||
print "unsort ";
|
||||
for i = a to b
|
||||
print rjust(array[i], 4);
|
||||
next i
|
||||
|
||||
call gnomeSort(array)
|
||||
|
||||
print chr(10); " sort ";
|
||||
for i = a to b
|
||||
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
|
||||
end subroutine
|
||||
Loading…
Add table
Add a link
Reference in a new issue