Crates.io | bin-tree |
lib.rs | bin-tree |
version | 0.10.1 |
source | src |
created_at | 2023-01-18 05:22:04.42036 |
updated_at | 2023-10-27 19:19:39.554243 |
description | Building Binary Tree |
homepage | |
repository | https://github.com/natfoam/lib |
max_upload_size | |
id | 761521 |
size | 14,904 |
The library provides an IteratorEx
trait that has a build_tree
method for any iterator of nodes that implement the Node
trait.
The build_tree
function returns the root node of the built tree if it was successfully built, otherwise it returns None
if the provided
iterator is empty.
The Node
trait represents a node in a binary tree. It provides two methods for creating a new parent node from child nodes:
new_parent(self, right: Self) -> Self
: creates a new parent node from two child nodes,new_parent_from_one(self) -> Self
: creates a new parent node from one child node.The implementation of these methods is specific to the type of node being used, and should be provided by the user.