21 releases

0.8.0 Sep 18, 2024
0.7.1 Apr 15, 2023
0.6.2 Feb 11, 2022
0.6.1 Sep 19, 2020

#271 in Data structures

Download history 140/week @ 2024-07-29 100/week @ 2024-08-05 79/week @ 2024-08-12 110/week @ 2024-08-19 75/week @ 2024-08-26 100/week @ 2024-09-02 225/week @ 2024-09-09 303/week @ 2024-09-16 314/week @ 2024-09-23 273/week @ 2024-09-30 48/week @ 2024-10-07 127/week @ 2024-10-14 188/week @ 2024-10-21 85/week @ 2024-10-28 35/week @ 2024-11-04 29/week @ 2024-11-11

343 downloads per month
Used in 3 crates

MIT license

120KB
3K SLoC

AVL Tree Map and Set in Rust

Build and test

An ordered map and set implemented with an AVL tree (nearly balanced binary search tree) in Rust.

use avl::AvlTreeMap;

let mut map = AvlTreeMap::new();
map.insert(0, "zero");
map.insert(1, "one");
map.insert(2, "two");
assert_eq!(map.get(&1), Some(&"one"));
map.remove(&1);
assert!(map.get(&1).is_none());


use avl::AvlTreeSet;

let mut set = AvlTreeSet::new();
set.insert(0);
set.insert(1);
set.insert(2);
assert!(set.contains(&1));
set.remove(&1);
assert!(!set.contains(&1));

This is solely to get practice with the dark art of unsafe Rust. For all common purposes one of the standard library collections should be preferable.


lib.rs:

Dictionary data structures implemented with an AVL tree (nearly balanced binary search tree).

No runtime deps