Table of Contents

Class Tree<T>

Namespace
Garyon.DataStructures.Trees
Assembly
Garyon.dll

Represents a tree.

public class Tree<T> : Tree<T, Tree<T>, TreeNode<T>>, ITree<T, Tree<T>, TreeNode<T>>, ITree<T>, ICollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T

The type of the elements the tree nodes store.

Inheritance
Tree<T, Tree<T>, TreeNode<T>>
Tree<T>
Implements
ITree<T, Tree<T>, TreeNode<T>>
Inherited Members
Extension Methods

Constructors

Tree()

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

public Tree()

Tree(TreeNode<T>)

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

public Tree(TreeNode<T> root)

Parameters

root TreeNode<T>

The root node.

Tree(Tree<T>)

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

public Tree(Tree<T> tree)

Parameters

tree Tree<T>

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

Tree(T)

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

public Tree(T rootValue)

Parameters

rootValue T

The value of the root node.

Methods

InitializeNewNode(TreeNode<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 TreeNode<T> InitializeNewNode(TreeNode<T> parentNode, T value = default)

Parameters

parentNode TreeNode<T>

The parent node.

value T

The value of the node.

Returns

TreeNode<T>

InitializeNewNode(Tree<T>, T)

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

protected override TreeNode<T> InitializeNewNode(Tree<T> baseTree, T value = default)

Parameters

baseTree Tree<T>

The base tree that contains this node.

value T

The value of the node.

Returns

TreeNode<T>

InitializeNewNode(T)

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

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

Parameters

value T

The value of the node.

Returns

TreeNode<T>