heap-data-structure/d-ary-heap

View on GitHub
src/core/sorted.js

Summary

Maintainability
A
45 mins
Test Coverage
import makeheap from './makeheap.js';
import pop from './pop.js';

export default function* sorted(arity, compare, swap, a, i, j) {
    makeheap(arity, compare, swap, a, i, j);

    for (; i < j; --j) yield pop(arity, compare, swap, a, i, j);
}