Tree_collections
The purpose of this library is to provide APIs that allows users to create memory efficient binary search tree, red-black tree and AVL tree. Besides, by using this library, users can investigate the performance difference between red-black tree and avl tree, which helps them deeply understand the algorithms.
Quick Start
use *;
let mut rb_tree = new;
rb_tree.insert;
rb_tree.insert;
rb_tree.insert;
rb_tree.insert;
rb_tree.insert;
rb_tree.delete;
println!;
rb_tree.print;
println!;
println!;
let mut avl_tree = new;
avl_tree.insert;
avl_tree.insert;
avl_tree.insert;
avl_tree.insert;
avl_tree.insert;
avl_tree.delete;
println!;
avl_tree.print;
println!;
println!;
Documentation
Building the documentation using
$ cargo doc
Find the API doc at
./target/doc/tree_collections/index.html
User Promote
Run the user promote
$ cargo run
List of operations
$ insert
$ delete
$ count
$ height
$ inorder print
$ preorder print
$ empty
$ search
$ print tree
$ exit
Testing
Run the tests using
$ cargo test
Benchmark
Run the Benchmark using
$ cargo bench
Requirements
Cargo version: 1.56^ Ref: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html