1 unstable release

0.1.0 Jul 6, 2020

#2508 in Data structures

MIT/Apache

10KB
236 lines

A library implementing a tournament tree data structure.

Tournament trees are, conceptually, complete binary trees holding the result of comparisons between each element of the tree. They can be used as a fixed size priority queue for applications like out-of-core sorting, or implementing many way joins.

use tournament_tree::TournamentTree;
let mut data1 = vec![3, 1, 4, 1, 5, 2, 6, 5];
let tourney_tree = TournamentTree::from(data1.clone());
data1.sort_by_key(|&e| Reverse(e));
let data2: Vec<_> = tourney_tree.into_iter().collect();
assert_eq!(data1, data2);

No runtime deps