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
TThe type of the elements the tree nodes store.
- Inheritance
-
BinarySearchTree<T>
- Implements
-
ITree<T>ICollection<T>IEnumerable<T>
- 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
rootBinarySearchTreeNode<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
treeBinarySearchTree<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
rootValueTThe 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
parentNodeBinarySearchTreeNode<T>The parent node.
valueTThe value of the node.
Returns
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
baseTreeBinarySearchTree<T>The base tree that contains this node.
valueTThe value of the node.
Returns
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
valueTThe value of the node.