-
Notifications
You must be signed in to change notification settings - Fork 16
IBinaryTreeNode
Kal Ahmed edited this page Sep 26, 2016
·
1 revision
Home > Trees > IBinaryTree > IBinaryTreeNode
IBinaryTreeNode is an extension to the basic ITreeNode interface which adds additional functionality specific to the needs of BinaryTree implementations.
Again we assume a IBinaryTreeNode<String,int> for simplicity in our examples, the IBinaryTreeNode adds the following additional functionality to the normal ITreeNode API:
//Get the Left Child
IBinaryTreeNode<String, int> left = node.LeftChild;
//Get the Right Child
IBinaryTreeNode<String, int> right = node.RightChild;
//Get the enumeration of nodes in the entire subtree (including this node)
IEnumerable<IBinaryTreeNode<String, int>> nodes = node.Nodes;
//Get the height of the subtree
int height = node.Height;
//Get the parent node (null if this is the root node)
IBinaryTreeNode<String, int> parent = node.Parent;