| Crates.io | rolling-median |
| lib.rs | rolling-median |
| version | 1.5.5 |
| created_at | 2025-10-19 15:29:02.279378+00 |
| updated_at | 2026-01-07 23:11:45.495958+00 |
| description | Compute the median using a 'rolling' (online) algorithm |
| homepage | |
| repository | https://github.com/lordmulder/rolling-median |
| max_upload_size | |
| id | 1890545 |
| size | 27,591 |
Computes the median of a data set, using a "rolling" (online) algorithm.
The push() operation has a complexity of: O(log(n))
The get() operation has a complexity of: O(1)
In order to use this crate, add it to [dependencies] in your Cargo.toml:
[dependencies]
rolling-median = "1.5.5"
Here is a simple example that demonstrates how to use it:
use rolling_median::Median;
fn main() {
let mut rolling_median = Median::new();
while let Some(value) = get_data() {
rolling_median.push(value);
println!("Median, so far: {:?}", rolling_median.get())
}
println!("Final median: {:?}", rolling_median.get())
}
fn get_data() -> Option<f64> { /* ... */ }
This software is released under the BSD Zero Clause (“0BSD”) License.
Copyright (C) 2025-2026 by LoRd_MuldeR <mulder2@gmx.de>.