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 m
The NGenerics project is a awesome collection of data structures and algorithms including a Binary Tree.
public class BinaryTree : IVisitableCollection, ITree
{
// Methods
public void Add(BinaryTree subtree);
public virtual void breadthFirstTraversal(IVisitor visitor);
public virtual void
DepthFirstTraversal(OrderedVisitor orderedVisitor);
public BinaryTree GetChild(int index);
public bool Remove(BinaryTree 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 this[int i] { get; }
public virtual BinaryTree Left { get; set; }
public virtual BinaryTree Right { get; set; }
// ...
}