bin-tree

Crates.iobin-tree
lib.rsbin-tree
version0.10.1
sourcesrc
created_at2023-01-18 05:22:04.42036
updated_at2023-10-27 19:19:39.554243
descriptionBuilding Binary Tree
homepage
repositoryhttps://github.com/natfoam/lib
max_upload_size
id761521
size14,904
Sergey Shandar (sergey-shandar)

documentation

README

Binary Tree Builder

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.

Node Trait

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.

Commit count: 212

cargo fmt