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 @@
|
|||
proc sort . d[] .
|
||||
n = len d[]
|
||||
# make heap
|
||||
for i = 2 to n
|
||||
if d[i] > d[(i + 1) div 2]
|
||||
j = i
|
||||
repeat
|
||||
h = (j + 1) div 2
|
||||
until d[j] <= d[h]
|
||||
swap d[j] d[h]
|
||||
j = h
|
||||
.
|
||||
.
|
||||
.
|
||||
for i = n downto 2
|
||||
swap d[1] d[i]
|
||||
j = 1
|
||||
ind = 2
|
||||
while ind < i
|
||||
if ind + 1 < i and d[ind + 1] > d[ind]
|
||||
ind += 1
|
||||
.
|
||||
if d[j] < d[ind]
|
||||
swap d[j] d[ind]
|
||||
.
|
||||
j = ind
|
||||
ind = 2 * j
|
||||
.
|
||||
.
|
||||
.
|
||||
data[] = [ 29 4 72 44 55 26 27 77 92 5 ]
|
||||
call sort data[]
|
||||
print data[]
|
||||
Loading…
Add table
Add a link
Reference in a new issue