Median Heap
Usage
Add this to your Cargo.toml
:
[]
= "0.3"
Example
Elements of a MedianHeap
must be Ord + AverageWith + Clone
.
The AverageWith
trait is used to calculate the mean value for the two middlemost items if the number of items is even. This is implemented for all integer types and the NotNan
type from the ordered-float
crate.
let mut heap = new;
heap.push;
assert_eq!;
heap.push;
assert_eq!;