Table of Contents

Class BinarySearchTree<T>

Namespace
Garyon.DataStructures.Trees
Assembly
Garyon.dll

Represents a tree.

public class BinarySearchTree<T> : BinarySearchTree<T, BinarySearchTree<T>, BinarySearchTreeNode<T>>, ITree<T, BinarySearchTree<T>, BinarySearchTreeNode<T>>, ITree<T>, ICollection<T>, IEnumerable<T>, IEnumerable where T : IComparable<T>

Type Parameters

T

The type of the elements the tree nodes store.

Inheritance
BinarySearchTree<T>
Implements
Inherited Members
Extension Methods

Constructors

BinarySearchTree()

Initializes a new instance of the BinarySearchTree<T> class with no root node.

public BinarySearchTree()

BinarySearchTree(BinarySearchTreeNode<T>)

Initializes a new instance of the BinarySearchTree<T> class with a root node.

public BinarySearchTree(BinarySearchTreeNode<T> root)

Parameters

root BinarySearchTreeNode<T>

The root node.

BinarySearchTree(BinarySearchTree<T>)

Initializes a new instance of the BinarySearchTree<T> class from a different tree.

public BinarySearchTree(BinarySearchTree<T> tree)

Parameters

tree BinarySearchTree<T>

The tree to create this tree from. Both trees remain independent.

BinarySearchTree(T)

Initializes a new instance of the BinarySearchTree<T> class with a root value.

public BinarySearchTree(T rootValue)

Parameters

rootValue T

The value of the root node.

Methods

InitializeNewNode(BinarySearchTreeNode<T>, T)

Initializes a new instance of the TreeNode<T> class with a parent node. The base tree is considered to be that of the parent.

protected override BinarySearchTreeNode<T> InitializeNewNode(BinarySearchTreeNode<T> parentNode, T value = default)

Parameters

parentNode BinarySearchTreeNode<T>

The parent node.

value T

The value of the node.

Returns

BinarySearchTreeNode<T>

InitializeNewNode(BinarySearchTree<T>, T)

Initializes a new instance of the TreeNode<T> class with a base tree, but no parent node.

protected override BinarySearchTreeNode<T> InitializeNewNode(BinarySearchTree<T> baseTree, T value = default)

Parameters

baseTree BinarySearchTree<T>

The base tree that contains this node.

value T

The value of the node.

Returns

BinarySearchTreeNode<T>

InitializeNewNode(T)

Initializes a new instance of the TreeNode<T> class with no base tree or parent node.

protected override BinarySearchTreeNode<T> InitializeNewNode(T value = default)

Parameters

value T

The value of the node.

Returns

BinarySearchTreeNode<T>