Tree Representation

Hi

I have some array in C# which i want to represent in a tree form. Actually what i need to do later on when implementing the algo is the traversal from roots to each leaf alternately. I want to know which data structure should i used to represent a tree What should specify a root and then what should specify a leaf I can do it i think on creating a custom class easily, but is there a default one available Thanks a lot for your kind perusal.

Regards,

Nab



Answer this question

Tree Representation

  • Tim Cartwright

    You can create a simple (custom) linked list. Here is one example.



  • JLB4536

    You can write a recursive function for this which will call him self until all the child nodes are processed.

  • egyamado

    Why not use the XmlDocument for this It has the methods for navigation through a tree.


  • beregen

    Yeah but Trees can have variable children (excluding Binary tree) and Linked list will allow me to access only the next and previous nodes. Then what for one, two, three or even no child
  • Tree Representation