Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > A doubt about C's tree data struct

Reply
Thread Tools

A doubt about C's tree data struct

 
 
dam_fool_2003@yahoo.com
Guest
Posts: n/a
 
      10-05-2003
I am just a beginner in tree data – struct. I have this little doubt.
Left node ‘weights' lesser than the right one. I have seen, so far it
is algorithm implementations. But why not vice-versa that is right
node ‘weights' lesser than the left one? Why the trees are implemented
in that way? Can any body clarify?

Thanks in advance
 
Reply With Quote
 
 
 
 
Joona I Palaste
Guest
Posts: n/a
 
      10-05-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) scribbled the following:
> I am just a beginner in tree data – struct. I have this little doubt.
> Left node ‘weights' lesser than the right one. I have seen, so far it
> is algorithm implementations. But why not vice-versa that is right
> node ‘weights' lesser than the left one? Why the trees are implemented
> in that way? Can any body clarify?


You haven't told us the definition of a node "weighing" something. So
your whole question is meaningless.
But I suspect that you are merely experiencing implementation-dependent
behaviour. The C standard does not specify anything about how
implementations must implement structure fields.

--
/-- Joona Palaste ((E-Mail Removed)) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"I wish someone we knew would die so we could leave them flowers."
- A 6-year-old girl, upon seeing flowers in a cemetery
 
Reply With Quote
 
 
 
 
Tristan Miller
Guest
Posts: n/a
 
      10-05-2003
Greetings.

In article <(E-Mail Removed) >,
(E-Mail Removed) wrote:
> I am just a beginner in tree data – struct. I have this little doubt.
> Left node ‘weights' lesser than the right one. I have seen, so far it
> is algorithm implementations. But why not vice-versa that is right
> node ‘weights' lesser than the left one? Why the trees are implemented
> in that way? Can any body clarify?


Simple convention; theoretically you could implement it either way. The
tradition probably stems from the fact that binary tree data structures
were invented and/or popularized in the Western world, where text and
sorted lists are usually written left to right. Hence, it's more natural
for us to put "lesser" things on the left and "greater" things on the
right.

Note that tree data structures are not unique to C, and as your question
doesn't seem to concern a C implementation in particular, this question is
probably better off in a more general newsgroup such as comp.programming.

Regards,
Tristan

--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      10-05-2003
dam_fool_2003 writes:

> I am just a beginner in tree data - struct. I have this little doubt.
> Left node 'weights' lesser than the right one. I have seen, so far it
> is algorithm implementations. But why not vice-versa that is right
> node 'weights' lesser than the left one? Why the trees are implemented
> in that way? Can any body clarify?


I think it is arbitrary, just like reading text left to right in most of the
world. I suppose it might possibly have something to do with people being
right handed. And why is that? And so on.


 
Reply With Quote
 
Peter Shaggy Haywood
Guest
Posts: n/a
 
      10-08-2003
Groovy hepcat (E-Mail Removed) was jivin' on 5 Oct 2003
06:07:42 -0700 in comp.lang.c.
A doubt about C's tree data struct's a cool scene! Dig it!

>I am just a beginner in tree data – struct. I have this little doubt.
>Left node ‘weights' lesser than the right one. I have seen, so far it
>is algorithm implementations. But why not vice-versa that is right
>node ‘weights' lesser than the left one? Why the trees are implemented
>in that way? Can any body clarify?


Your subject line is nonsensical. C doesn't have a "tree data
struct". And your question has nothing whatsoever to do with C. It is
an algorithm question that doesn't even make much sense. Please ask
more clearly in a more appropriate newsgroup, such as
comp.programming.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 
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
dotnet doubt can any body clarify my doubt challa462@gmail.com ASP .Net 0 08-22-2012 06:02 AM
Can *common* struct-members of 2 different struct-types, that are thesame for the first common members, be accessed via pointer cast to either struct-type? John Reye C Programming 28 05-08-2012 12:24 AM
doubt about doubt Bob Nelson C Programming 11 07-30-2006 08:17 PM
struct my_struct *p = (struct my_struct *)malloc(sizeof(struct my_struct)); Chris Fogelklou C Programming 36 04-20-2004 08:27 AM
B tree, B+ tree and B* tree Stub C Programming 3 11-12-2003 01:51 PM



Advertisments