Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objects that represent trees

Tags:

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?

like image 467
Russell Avatar asked Nov 27 '09 02:11

Russell


People also ask

What symbolizes a tree?

Since ancient days, trees have been used to represent life, growth, wisdom, prosperity and more in legends, poetry, literature, and religion.

What is the most symbolic tree?

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.

What tree symbolizes in life?

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.

What tree is a symbol of strength?

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.


1 Answers

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; }      // ... } 
like image 54
Bob Avatar answered Oct 14 '22 17:10

Bob