rangequeries
An implementation of Range Queries in Nim
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-22 05:27 |
Tags
Installation
nimble install rangequeries
choosenim install rangequeries
git clone https://github.com/vanyle/RangeQueriesNim
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| rangequeries | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/vanyle/RangeQueriesNim |
|---|---|
| Homepage | https://github.com/vanyle/RangeQueriesNim/ |
| Registry Source | nimble_official |
README
RangeQueries
This nim package implements "SegmentTree", a data structure that allows you to respond to "Range Queries" in O(log(n)) time.
More information about Segment Trees here: https://en.wikipedia.org/wiki/Segment_tree
Usage
var nbrs: seq[int] = @[]
for i in 1 .. 20:
nbrs.add(i)
proc add(a, b: int): int =
a + b
var st = toSegmentTree[int](nbrs, add)
echo st.query(3, 5) # 4 + 5 + 6 = 15
Complete documentation available here
Tests
Even more examples in tests.
Contributing
Feel free to implement more data structures to respond to range queries.