pub struct BinarySearchTree<T> { /* private fields */ }

Implementations

Contructor creates BinarySearchTree root node

Delegates tree building to BinarySearchTree::build_recursive() This sorts vector input and pass splice to tree builder.

Recursively builds tree maintaining BST properties. Uses O(n) time.

Inorder traverse tree which yields elements in sorted order. Uses O(n) time.

Traverse tree in preorder. Uses O(n) time.

Calculates tree maximum height Worst case O(n)

Inserts an element in a tree. Uses O(n) time.

Checks if element exists in a tree. Uses O(n) time.

Finds minimum element in a tree. Uses O(n) time.

Finds maximum element in a tree. Uses O(n) time.

Trait Implementations

implement consumable IntoIterator for BinarySearchTree

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Implement non-consumable IntoIterator for BinarySearchTree

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.