Class BinaryTree<T>
- Namespace
- Garyon.DataStructures.Trees
- Assembly
- Garyon.dll
Represents a binary tree.
public class BinaryTree<T> : BinaryTree<T, BinaryTree<T>, BinaryTreeNode<T>>, ITree<T, BinaryTree<T>, BinaryTreeNode<T>>, ITree<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
TThe type of the elements the binary tree nodes store.
- Inheritance
-
BinaryTree<T>
- Implements
-
ITree<T>ICollection<T>IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
BinaryTree()
Initializes a new instance of the BinaryTree<T> class with no root node.
public BinaryTree()
BinaryTree(BinaryTreeNode<T>)
Initializes a new instance of the BinaryTree<T> class with a root node.
public BinaryTree(BinaryTreeNode<T> root)
Parameters
rootBinaryTreeNode<T>The root node.
BinaryTree(BinaryTree<T>)
Initializes a new instance of the BinaryTree<T> class from a different tree.
public BinaryTree(BinaryTree<T> tree)
Parameters
treeBinaryTree<T>The tree to create this tree from. Both trees remain independent.
BinaryTree(T)
Initializes a new instance of the BinaryTree<T> class with a root value.
public BinaryTree(T rootValue)
Parameters
rootValueTThe value of the root node.
Methods
InitializeNewNode(BinaryTreeNode<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 BinaryTreeNode<T> InitializeNewNode(BinaryTreeNode<T> parentNode, T value = default)
Parameters
parentNodeBinaryTreeNode<T>The parent node.
valueTThe value of the node.
Returns
InitializeNewNode(BinaryTree<T>, T)
Initializes a new instance of the TreeNode<T> class with a base tree, but no parent node.
protected override BinaryTreeNode<T> InitializeNewNode(BinaryTree<T> baseTree, T value = default)
Parameters
baseTreeBinaryTree<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 BinaryTreeNode<T> InitializeNewNode(T value = default)
Parameters
valueTThe value of the node.