🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

1d-range-query

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

1d-range-query

Efficient range maximum/minimum query

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

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

RMQ

FAQs

Package last updated on 23 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts