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 @@
|
|||
* # Sort array in place, return array
|
||||
define('bubble(a,alen)i,j,ub,tmp') :(bubble_end)
|
||||
bubble i = 1; ub = alen
|
||||
outer gt(ub,1) :f(bdone)
|
||||
j = 1
|
||||
inner le(a<j>, a<j + 1>) :s(incrj)
|
||||
tmp = a<j>
|
||||
a<j> = a<j + 1>
|
||||
a<j + 1> = tmp
|
||||
incrj j = lt(j + 1,ub) j + 1 :s(inner)
|
||||
ub = ub - 1 :(outer)
|
||||
bdone bubble = a :(return)
|
||||
bubble_end
|
||||
|
||||
* # Fill array with test data
|
||||
str = '33 99 15 54 1 20 88 47 68 72'
|
||||
output = str; arr = array(10)
|
||||
floop i = i + 1; str span('0123456789') . arr<i> = :s(floop)
|
||||
|
||||
* # Test and display
|
||||
bubble(arr,10); str = ''
|
||||
sloop j = j + 1; str = str arr<j> ' ' :s(sloop)
|
||||
output = trim(str)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue