Are there any objects in C# (or in .net) that represents a binary tree (or for curiosity) and n-ary tree?
I am not talking about presentation tree controls, but as model objects.
If not, are there any good external implementations?
Since ancient days, trees have been used to represent life, growth, wisdom, prosperity and more in legends, poetry, literature, and religion.
Oak. Across various mythologies and literature, the sturdy oak tree is portrayed as a symbol of strength, stability, and protection, standing strong through all things. These trees are also thought to provide comfort and are considered spiritual guardians by some cultures.
A symbol of personal growth, strength and beauty The Tree of Life symbol represents our personal development, uniqueness and individual beauty. Just as the branches of a tree strengthen and grow upwards to the sky, we too grow stronger, striving for greater knowledge, wisdom and new experiences as we move through life.
Symbolism of the Mighty OakThe Oak tree is one of the most loved trees in the world, and with good reason. It's a symbol of strength, morale, resistance and knowledge.
The NGenerics project is a awesome collection of data structures and algorithms including a Binary Tree.
public class BinaryTree<T> : IVisitableCollection<T>, ITree<T> { // Methods public void Add(BinaryTree<T> subtree); public virtual void breadthFirstTraversal(IVisitor<T> visitor); public virtual void DepthFirstTraversal(OrderedVisitor<T> orderedVisitor); public BinaryTree<T> GetChild(int index); public bool Remove(BinaryTree<T> child); public virtual void RemoveLeft(); public virtual void RemoveRight(); // ... // Properties public virtual T Data { get; set; } public int Degree { get; } public virtual int Height { get; } public virtual bool IsLeafNode { get; } public BinaryTree<T> this[int i] { get; } public virtual BinaryTree<T> Left { get; set; } public virtual BinaryTree<T> Right { get; set; } // ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With