Sorting algorithms/Heapsort: Difference between revisions
Content added Content deleted
Line 1,995: | Line 1,995: | ||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
<lang julia>function pd!(a, first, last) |
<lang julia>function pd!(a, first, last) |
||
while (c = 2 * first - 1) < last |
|||
while (c = 2 * r - 1) < last |
|||
if c < last && a[c] < a[c + 1] |
if c < last && a[c] < a[c + 1] |
||
c += 1 |
c += 1 |
||
end |
end |
||
if a[ |
if a[first] < a[c] |
||
a[c], a[ |
a[c], a[first] = a[first], a[c] |
||
first = c |
|||
else |
else |
||
break |
break |