Crates.io | ds-bst |
lib.rs | ds-bst |
version | 0.3.0 |
source | src |
created_at | 2021-04-26 15:22:14.695364 |
updated_at | 2022-03-15 20:56:56.986034 |
description | Binary search tree implementation |
homepage | |
repository | https://github.com/iapain/rust-bst |
max_upload_size | |
id | 389746 |
size | 11,849 |
Implements a Binary Search Tree in Rust. This is a recursive data structure and left and right refers to sub trees.
In your cargo dependencies add following
ds-bst = "*"
use ds_bst::BinarySearchTree;
let mut node = BinarySearchTree:new(5);
node.insert(1);
node.insert(2);
node.insert(10);
// or
let mut root = BinarySearchTree::from(vec![1,2,3,4,5,6,7,8,9]);
root.insert(10);
let ordered: Vec<_> = root.inorder();
let min = root.find_min();
let max = root.find_max();