Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -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
)

View file

@ -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)