Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
get "libhdr"
|
||||
|
||||
let gnomesort(A, len) be
|
||||
$( let i=1 and j=2 and t=?
|
||||
while i < len
|
||||
test A!(i-1) <= A!i
|
||||
$( i := j
|
||||
j := j + 1
|
||||
$)
|
||||
or
|
||||
$( t := A!(i-1)
|
||||
A!(i-1) := a!i
|
||||
A!i := t
|
||||
i := i - 1
|
||||
if i = 0
|
||||
$( i := j
|
||||
j := j + 1
|
||||
$)
|
||||
$)
|
||||
$)
|
||||
|
||||
let writearray(A, len) be
|
||||
for i=0 to len-1 do
|
||||
writed(A!i, 6)
|
||||
|
||||
let start() be
|
||||
$( let array = table 52, -5, -20, 199, 65, -3, 190, 25, 9999, -5342
|
||||
let length = 10
|
||||
|
||||
writes("Input: ") ; writearray(array, length) ; wrch('*N')
|
||||
gnomesort(array, length)
|
||||
writes("Output: ") ; writearray(array, length) ; wrch('*N')
|
||||
$)
|
||||
Loading…
Add table
Add a link
Reference in a new issue