integer-sorting/radix-sort

View on GitHub
src/array/core/accumulate.js

Summary

Maintainability
A
0 mins
Test Coverage
import assert from 'assert';

/**
 * O(M) time where M=j-i.
 */
const accumulate = (array, i, j) => {
    assert(i >= 0 && j <= array.length);
    for (++i; i < j; ++i) {
        array[i] += array[i - 1];
    }
};

export default accumulate;