A double-ended priority queue
Rust
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
benches
src
.gitignore
.travis.yml
CHANGELOG.md
Cargo.toml
LICENSE-APACHE
LICENSE-MIT
README.md
release.toml

README.md

min-max-heap: a double-ended priority queue

Build Status Crates.io License: MIT License: Apache 2.0

A min-max-heap is like a binary heap, but it allows extracting both the minimum and maximum value efficiently. In particular, finding either the minimum or maximum element is O(1). A removal of either extremum, or an insertion, is O(log n).

Usage

It’s on crates.io, so add this to your Cargo.toml:

[dependencies]
min-max-heap = "1.2.0"

And add this to your crate root:

extern crate min_max_heap;

This crate supports Rust version 1.20.0 and later.

References

My reference for a min-max heap is here. Much of this code is also based on BinaryHeap from the standard library.