Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,18 @@
|
|||
fn stoogeSort arr i: j: =
|
||||
(
|
||||
if i == unsupplied do i = 1
|
||||
if j == unsupplied do j = arr.count
|
||||
|
||||
if arr[j] < arr[i] do
|
||||
(
|
||||
swap arr[j] arr[i]
|
||||
)
|
||||
if j - i > 1 do
|
||||
(
|
||||
local t = (j - i+1)/3
|
||||
arr = stoogeSort arr i:i j:(j-t)
|
||||
arr = stoogeSort arr i:(i+t) j:j
|
||||
arr = stoogeSort arr i:i j:(j-t)
|
||||
)
|
||||
return arr
|
||||
)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
a = for i in 1 to 15 collect random 1 20
|
||||
#(10, 2, 1, 19, 18, 20, 18, 5, 13, 2, 13, 9, 7, 10, 6)
|
||||
stoogeSort a
|
||||
#(1, 2, 2, 5, 6, 7, 9, 10, 10, 13, 13, 18, 18, 19, 20)
|
||||
Loading…
Add table
Add a link
Reference in a new issue