Median accumulator

Simple, space-efficient algorithm to compute the median of an accumulation of elements.

Faster than other implementations if there are samples having the same value. If this is not your case, you should use another implementation.

Use

```rust use median_accumulator::*;

let mut acc = vec::MedianAcc::new();

asserteq!(acc.getmedian(), None); acc.push(7); asserteq!(acc.getmedian(), Some(MedianResult::One(7))); acc.push(5); asserteq!(acc.getmedian(), Some(MedianResult::Two(5, 7))); acc.push(7); asserteq!(acc.getmedian(), Some(MedianResult::One(7))); ```

If you ever encounter an unreachable panic, please file an issue or send me an e-mail.

no_std

Example with smallvec: (smallvec feature required)

```rust use median_accumulator::*;

let mut acc = MedianAcc::

For other collections than Vec or SmallVec, you must implement cc-traits and InsertIndex.

License

CopyLeft 2022-2023 Pascal Engélibert (why copyleft?)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.