Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Hi, I want to implement a General Tree Data structure (Not Binary Tree ) which have more than 2 sub nodes?

Reply
Thread Tools

Hi, I want to implement a General Tree Data structure (Not Binary Tree ) which have more than 2 sub nodes?

 
 
sharan
Guest
Posts: n/a
 
      10-30-2007
Hello Friends I have a problem in Data Structure (In C) i want to
implement a General tree having three child nodes of each parent
node ...please send me any simple Example( code) by which i can
understand General Tree codes.....node be int value if possible than
help me for a name(string)

 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      10-30-2007
sharan said:

> Hello Friends I have a problem in Data Structure (In C) i want to
> implement a General tree having three child nodes of each parent
> node ...please send me any simple Example( code) by which i can
> understand General Tree codes.....node be int value if possible than
> help me for a name(string)


See K&R2 pp139-142 to see how to build a tree using two child nodes, and
then make the obvious change for three nodes. (At this point, of course,
it will no longer be a binary search tree, so you'll need to decide how
you're going to track down nodes within the tree.)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
 
Reply With Quote
 
 
 
 
Dan Kruchinin
Guest
Posts: n/a
 
      10-30-2007
On Oct 30, 12:38 pm, sharan <(E-Mail Removed)> wrote:
> Hello Friends I have a problem in Data Structure (In C) i want to
> implement a General tree having three child nodes of each parent
> node ...please send me any simple Example( code) by which i can
> understand General Tree codes.....node be int value if possible than
> help me for a name(string)



firs of all you need to understand how to build the abstract tree data
structure(if you still don't know it):
http://en.wikipedia.org/wiki/Tree_%28data_structure%29 (read theory,
then walk throw the different trees implementations description, each
article should contain at leas one link to particular tree sources).

here for example avl tree sources. i think if you understand how it
works, you can easily make needful changes:
http://en.wikipedia.org/wiki/Tree_%28data_structure%29

Dan Kruchinin
W.B.R.

 
Reply With Quote
 
Dan Kruchinin
Guest
Posts: n/a
 
      10-30-2007
> here for example avl tree sources. i think if you understand how it
> works, you can easily make needful changes:http://en.wikipedia.org/wiki/Tree_%28data_structure%29


sorry, it was invalid link. here is valid one:
http://src.opensolaris.org/source/xr...mmon/avl/avl.c

Dan Kruchinin
W.B.R.


 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      10-30-2007
sharan wrote:
>
> Hello Friends I have a problem in Data Structure (In C) i want to
> implement a General tree having three child nodes of each parent
> node ...please send me any simple Example( code) by which i can
> understand General Tree codes.....node be int value if possible
> than help me for a name(string)


struct node {
struct node *left, *middle, *right; /* children */
char *data; /* or whatever type you need */
}

Go from there.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Like all great travelers, I have seen more than I remember andremember more than I have seen. shenrilaa@gmail.com Java 0 03-06-2008 08:11 AM
Like all great travelers, I have seen more than I remember andremember more than I have seen. shenrilaa@gmail.com C++ 0 03-05-2008 08:41 AM
Like all great travelers, I have seen more than I remember andremember more than I have seen. shenrilaa@gmail.com C Programming 0 03-05-2008 03:26 AM
Hi, I want to implement a General Tree Data structure (Not Binary Tree ) which have more than 2 sub nodes? sharan C Programming 2 10-31-2007 02:58 AM
Hi, I want to implement a General Tree Data structure (Not Binary Tree ) which have more than 2 sub nodes? sharan C Programming 1 10-30-2007 11:01 PM



Advertisments