Sorting algorithms/Heapsort: Difference between revisions
→{{header|EasyLang}}
Line 2,219:
=={{header|EasyLang}}==
<syntaxhighlight lang="text">
func sort . d[] .
for i = 1 to n - 1▼
n = len d[]
if data[i] > data[(i - 1) / 2]▼
# make heap
j = i
until d[j] <=
.
.
.
swap d[1] d[i]
ind = 2
▲ for i = n - 1 downto 1
▲ swap data[0] data[i]
▲ j = 0
▲ ind = 1
while ind < i
if ind + 1 < i and
ind += 1
.
if
swap
.
j = ind
ind = 2 * j
.
.
.
data[] = [ 29 4 72 44 55 26 27 77 92 5 ]
call sort data[]
print data[]
</syntaxhighlight>
=={{header|EchoLisp}}==
|