Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
get "libhdr"
|
||||
|
||||
let stoogesort(L, i, j) be
|
||||
$( if L!j < L!i then
|
||||
$( let x = L!i
|
||||
L!i := L!j
|
||||
L!j := x
|
||||
$)
|
||||
if j-i>1 then
|
||||
$( let t = (j - i + 1)/3
|
||||
stoogesort(L, i, j-t)
|
||||
stoogesort(L, i+t, j)
|
||||
stoogesort(L, i, j-t)
|
||||
$)
|
||||
$)
|
||||
|
||||
let write(s, A, len) be
|
||||
$( writes(s)
|
||||
for i=0 to len-1 do writed(A!i, 4)
|
||||
wrch('*N')
|
||||
$)
|
||||
|
||||
let start() be
|
||||
$( let array = table 4,65,2,-31,0,99,2,83,782,1
|
||||
let length = 10
|
||||
write("Before: ", array, length)
|
||||
stoogesort(array, 0, length-1)
|
||||
write("After: ", array, length)
|
||||
$)
|
||||
Loading…
Add table
Add a link
Reference in a new issue