moving min max
Keep track of the minimum or maximum value in a sliding window.
moving min max
provides one data structure for keeping track of the
minimum value and one for keeping track of the maximum value in a sliding
window.
The algorithm is based on the description here.
The complexity of the operations are
- O(1) for getting the minimum/maximum
- O(1) for push
- amortized O(1) for pop
use MovingMin;
let mut moving_min = new;
moving_min.push;
moving_min.push;
moving_min.push;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
or
use MovingMax;
let mut moving_max = new;
moving_max.push;
moving_max.push;
moving_max.push;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;