Re: [LAD] multi branch tree in c

From: Jack O'Quin <jack.oquin@email-addr-hidden>
Date: Fri Jul 11 2008 - 06:03:50 EEST

On Thu, Jul 10, 2008 at 5:39 PM, Julien Claassen <julien@email-addr-hidden-lab.de> wrote:
> Hello again!
> I'm sorry, but my earlier experiments don't seem worth the effort. Now I
> thought, this has all been done and perhaps someone can help me. I need a tree
> stucture in C, based on struct, where each node has a list of subnodes. like
> this:
> (root(e1(e11,e12,e13(e131,e132,e133,e134,e135)),e2)
> If you get what I mean. Does anyone know of such a structure almost made
> ready for use? I'm sure I heard the official name for this in my lectures, but
> alas it's long ago.
> Yes, I did consider doing this in c++, but then readline will get me down on
> my knees again and will have my crying in frustration and defeat, as it did
> last time. :-(

The usual solution is a "node" struct for each element in the tree.
It normally has two pointers, one to the first child, and one to the next
sibling. A parent pointer may also be useful if you need to traverse the
tree starting somewhere other than the root. Leaf nodes have a NULL
child pointer.

-- 
 joq
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Fri Jul 11 08:15:02 2008

This archive was generated by hypermail 2.1.8 : Fri Jul 11 2008 - 08:15:02 EEST