tournament_kway/
lib.rs

1//! An implementation of a `k`-way merge iterator using a binary heap.
2//! The `k`-way merge iterator is very useful when given `k` sets
3//! of sorted data, you want to find the `n` top elements in between
4//! the sets in an efficient way, without sorting the entire data set.
5//!
6//! Imagine having dozens of slices with hundreds of elements, where
7//! you only care about the top 10.
8//!
9//! ```
10//! use tournament_kway::Tournament;
11//!
12//! let t = Tournament::from_iters_min([(1..2000), (1..20000), (1..5000000)]);
13//! assert_eq!(t.take(5).collect::<Vec<_>>(), [1, 1, 1, 2, 2]);
14//!
15//! ```
16mod comparator;
17mod iter_tournament;
18mod streaming_tournament;
19
20pub use comparator::*;
21pub use iter_tournament::Tournament;
22pub use streaming_tournament::StreamingTournament;