Class TreeTraversal
Static class with tree traversal methods.
Inheritance
System.Object
TreeTraversal
Namespace: ISynergy.Framework.Core.Collections
Assembly: ISynergy.Framework.Core.dll
Syntax
public static class TreeTraversal : object
Methods
View SourceBreadthFirst<TNode>(BinaryTree<TNode>)
Breadth-first tree traversal method.
Declaration
public static IEnumerator<TNode> BreadthFirst<TNode>(BinaryTree<TNode> tree)
where TNode : BinaryNode<TNode>, new()
Parameters
Type | Name | Description |
---|---|---|
BinaryTree<TNode> | tree | The tree. |
Returns
Type | Description |
---|---|
IEnumerator<TNode> | IEnumerator<TNode>. |
Type Parameters
Name | Description |
---|---|
TNode | The type of the t node. |
DepthFirst<TNode>(BinaryTree<TNode>)
Depth-first tree traversal method.
Declaration
public static IEnumerator<TNode> DepthFirst<TNode>(BinaryTree<TNode> tree)
where TNode : BinaryNode<TNode>
Parameters
Type | Name | Description |
---|---|---|
BinaryTree<TNode> | tree | The tree. |
Returns
Type | Description |
---|---|
IEnumerator<TNode> | IEnumerator<TNode>. |
Type Parameters
Name | Description |
---|---|
TNode | The type of the t node. |
InOrder<TNode>(BinaryTree<TNode>)
In-order tree traversal method.
Declaration
public static IEnumerator<TNode> InOrder<TNode>(BinaryTree<TNode> tree)
where TNode : BinaryNode<TNode>, new()
Parameters
Type | Name | Description |
---|---|---|
BinaryTree<TNode> | tree | The tree. |
Returns
Type | Description |
---|---|
IEnumerator<TNode> | IEnumerator<TNode>. |
Type Parameters
Name | Description |
---|---|
TNode | The type of the t node. |
PostOrder<TNode>(BinaryTree<TNode>)
Post-order tree traversal method.
Declaration
public static IEnumerator<TNode> PostOrder<TNode>(BinaryTree<TNode> tree)
where TNode : BinaryNode<TNode>, new()
Parameters
Type | Name | Description |
---|---|---|
BinaryTree<TNode> | tree | The tree. |
Returns
Type | Description |
---|---|
IEnumerator<TNode> | IEnumerator<TNode>. |
Type Parameters
Name | Description |
---|---|
TNode | The type of the t node. |
PreOrder<TNode>(BinaryTree<TNode>)
Pre-order tree traversal method.
Declaration
public static IEnumerator<TNode> PreOrder<TNode>(BinaryTree<TNode> tree)
where TNode : BinaryNode<TNode>, new()
Parameters
Type | Name | Description |
---|---|---|
BinaryTree<TNode> | tree | The tree. |
Returns
Type | Description |
---|---|
IEnumerator<TNode> | IEnumerator<TNode>. |
Type Parameters
Name | Description |
---|---|
TNode | The type of the t node. |