Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -1,21 +1,21 @@
|
|||
gnomesort = function(a)
|
||||
i = 1
|
||||
j = 2
|
||||
while i < a.len
|
||||
if a[i-1] <= a[i] then
|
||||
i = j
|
||||
j = j + 1
|
||||
else
|
||||
k = a[i-1]
|
||||
a[i-1] = a[i]
|
||||
a[i] = k
|
||||
i = i - 1
|
||||
if i == 0 then
|
||||
i = j
|
||||
j = j + 1
|
||||
end if
|
||||
end if
|
||||
end while
|
||||
i = 1
|
||||
j = 2
|
||||
while i < a.len
|
||||
if a[i-1] <= a[i] then
|
||||
i = j
|
||||
j = j + 1
|
||||
else
|
||||
k = a[i-1]
|
||||
a[i-1] = a[i]
|
||||
a[i] = k
|
||||
i = i - 1
|
||||
if i == 0 then
|
||||
i = j
|
||||
j = j + 1
|
||||
end if
|
||||
end if
|
||||
end while
|
||||
end function
|
||||
a = [3, 7, 4, 2, 5, 1, 6]
|
||||
gnomesort(a)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue