# 1d-range-query

> Efficient range maximum/minimum query

Latest version **1.0.2** (published 2016-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install 1d-range-query
pnpm add 1d-range-query
yarn add 1d-range-query
bun add 1d-range-query
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-03-23 |
| First published | 2016-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Breezewish |
| Maintainers | breezewish |
| Keywords | RMQ |

## Links

- npm: https://www.npmjs.com/package/1d-range-query
- Repository: https://github.com/SummerWish/1d-range-query
- Homepage: https://github.com/SummerWish/1d-range-query#readme
- Issues: https://github.com/SummerWish/1d-range-query/issues
- npm.io page: https://npm.io/package/1d-range-query

## Recent versions

- 1.0.2 (latest) — 2016-03-23
- 1.0.1 — 2016-03-22
- 1.0.0 — 2016-03-22

## README

# 1d-range-query

[![Build Status](https://travis-ci.org/SummerWish/1d-range-query.svg?branch=master)](https://travis-ci.org/SummerWish/1d-range-query)
[![Coverage Status](https://coveralls.io/repos/github/SummerWish/1d-range-query/badge.svg?branch=master)](https://coveralls.io/github/SummerWish/1d-range-query?branch=master)
[![Dependency Status](https://david-dm.org/SummerWish/1d-range-query.svg)](https://david-dm.org/SummerWish/1d-range-query)
[![npm version](http://img.shields.io/npm/v/1d-range-query.svg?style=flat)](https://npmjs.org/package/1d-range-query "View this project on npm")
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)

Efficient range maximum/minimum query.

```bash
npm install 1d-range-query
```

## Usage

```js
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

---
_Source: https://npm.io/package/1d-range-query · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
