Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
fn gnomeSort arr =
|
||||
(
|
||||
local i = 2
|
||||
local j = 3
|
||||
while i <= arr.count do
|
||||
(
|
||||
if arr[i-1] <= arr[i] then
|
||||
(
|
||||
i = j
|
||||
j += 1
|
||||
)
|
||||
else
|
||||
(
|
||||
swap arr[i-1] arr[i]
|
||||
i -= 1
|
||||
if i == 1 then
|
||||
(
|
||||
i = j
|
||||
j += 1
|
||||
)
|
||||
)
|
||||
)
|
||||
return arr
|
||||
)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
a = for i in 1 to 10 collect random 1 20
|
||||
#(20, 10, 16, 2, 19, 12, 11, 3, 5, 16)
|
||||
gnomesort a
|
||||
#(2, 3, 5, 10, 11, 12, 16, 16, 19, 20)
|
||||
Loading…
Add table
Add a link
Reference in a new issue