Sorting algorithms/Heapsort: Difference between revisions
Content added Content deleted
(Added zkl) |
m (added FunL) |
||
Line 923: | Line 923: | ||
while root*2 + 1 <= end |
while root*2 + 1 <= end |
||
child = root*2 + 1 |
child = root*2 + 1 |
||
if child + 1 <= end and a(child) < a(child + 1) |
if child + 1 <= end and a(child) < a(child + 1) |
||
child++ |
child++ |
||
if a(root) < a(child) |
if a(root) < a(child) |
||
a(root), a(child) = a(child), a(root) |
a(root), a(child) = a(child), a(root) |