8 releases
Uses old Rust 2015
0.1.8 | Oct 6, 2015 |
---|---|
0.1.7 | Mar 26, 2015 |
0.1.5 | Feb 20, 2015 |
0.1.3 | Jan 9, 2015 |
0.1.0 | Nov 13, 2014 |
#2350 in Data structures
23KB
519 lines
Splay Trees
This is an implementation of splay trees written in Rust. This was mostly a proof of concept work, and it ended up working out well!
This repo is provided as a Cargo package, simply adjust your Cargo.toml
to
include
[dependencies]
splay = "0.1"
This code is all released under the MIT license. The implementation of splaying is largely based on ftp://ftp.cs.cmu.edu/usr/ftp/usr/sleator/splaying/top-down-splay.c
lib.rs
:
Contains an implementation of splay trees where each node has a key/value pair to be used in maps and sets. The only requirement is that the key must implement the Ord trait.
Example
use splay::SplayMap;
let mut map = SplayMap::new();
map.insert("foo", "bar");
map.insert("hello", "world");
map.insert("splay", "tree");
for (k, v) in map.into_iter() {
println!("{} => {}", k, v);
}