{"id":16126779,"url":"https://github.com/mikolalysenko/range-minimum-query","last_synced_at":"2026-02-25T11:02:18.501Z","repository":{"id":15492620,"uuid":"18226443","full_name":"mikolalysenko/range-minimum-query","owner":"mikolalysenko","description":"Preprocess an array to find the smallest element in any given interval in O(1)","archived":false,"fork":false,"pushed_at":"2014-03-29T14:22:40.000Z","size":140,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T11:33:19.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikolalysenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-28T21:04:47.000Z","updated_at":"2018-01-12T22:52:40.000Z","dependencies_parsed_at":"2022-08-25T16:21:31.323Z","dependency_job_id":null,"html_url":"https://github.com/mikolalysenko/range-minimum-query","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikolalysenko%2Frange-minimum-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikolalysenko%2Frange-minimum-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikolalysenko%2Frange-minimum-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikolalysenko%2Frange-minimum-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikolalysenko","download_url":"https://codeload.github.com/mikolalysenko/range-minimum-query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670459,"owners_count":21142896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T21:40:20.794Z","updated_at":"2026-02-25T11:02:18.419Z","avatar_url":"https://github.com/mikolalysenko.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"range-minimum-query\n===================\nGiven an array of elements, preprocess the array so that range minimum queries can be computed in constant time.\n\n\n# Example\n\n```javascript\nvar array = [9, 3, 7, 1, 8, 12, 10, 20, 15, 18, 5]\nvar rmq = require(\"range-minimum-query\")(array)\n\nconsole.log(rmq(-Infinity, Infinity), rmq(0, 3))\n```\n\nOutput:\n\n```javascript\n3 1\n```\n\n# Install\n\n```\nnpm install range-minimum-query\n```\n\n# API\n\n### `var rmq = require(\"range-minimum-query\")(array[,compare])`\nPreprocess `array` for fast range minimum queries\n\n* `array` is an array of objects\n* `compare` is an optional comparison function determining an ordering on `array`\n\n**Returns** A function `rmq` for answering range minimum queries on `array`\n\n### `rmq(lo, hi)`\nFinds the index of the smallest element in the range `[lo,hi)` in `array`\n\n* `lo` is the start index of the bounds\n* `hi` is the end index of the bounds (non-inclusive)\n\n**Returns** The index of the smallest element in the range `[lo, hi)` in `array`\n\n# Credits\n(c) 2014 Mikola Lysenko. MIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikolalysenko%2Frange-minimum-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikolalysenko%2Frange-minimum-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikolalysenko%2Frange-minimum-query/lists"}