tournament_tree 0.1.0

A tournament tree library
Documentation
  • Coverage
  • 83.33%
    10 out of 12 items documented1 out of 12 items with examples
  • Size
  • Source code size: 20.25 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.56 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • chrisvittal

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;
# use std::cmp::Reverse;
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);