Neverending Puppy Marathon

    1d-range-query

    1.0.2 • Public • Published

    1d-range-query

    Build Status Coverage Status Dependency Status npm version MIT license

    Efficient range maximum/minimum query.

    npm install 1d-range-query

    Usage

    import rangeQuery from '1d-range-query';
    const query = rangeQuery([1,5,10,2,5,3]);
    console.log(query.max(0, 2)); // => 10 (10 is the max in [1,5,10])
    console.log(query.min(2, 4)); // => 2 (2 is the min in [10,2,5])

    #query.max(from, to)

    Query the maximum value in range [from, to].

    #query.min(from, to)

    Query the minimum value in range [from, to].

    Complexity

    Time

    Initialize: O(nlogn)

    Query: O(1)

    Space

    O(nlogn)

    License

    MIT

    Keywords

    Install

    npm i 1d-range-query

    DownloadsWeekly Downloads

    1

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • breezewish