Anonymous user
Sorting algorithms/Heapsort: Difference between revisions
m
→{{header|Scala}}: better style
(→{{header|MATLAB}}: Added a better explanation of the code) |
m (→{{header|Scala}}: better style) |
||
Line 1,147:
// Maintain partial ordering by bubbling down elements
@tailrec
def siftDown(i: Int, heapSize: Int) {
val childrenOfI = children(i, heapSize)
if (childrenOfI nonEmpty) {
|