A doubt about C's tree data struct

Discussion in 'C Programming' started by dam_fool_2003@yahoo.com, Oct 5, 2003.

  1. Guest

    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
     
    , Oct 5, 2003
    #1
    1. Advertising

  2. 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 () ---------------------------\
    | 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
     
    Joona I Palaste, Oct 5, 2003
    #2
    1. Advertising

  3. Greetings.

    In article <>,
    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
     
    Tristan Miller, Oct 5, 2003
    #3
  4. osmium Guest

    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.
     
    osmium, Oct 5, 2003
    #4
  5. Groovy hepcat 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"?
     
    Peter Shaggy Haywood, Oct 8, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stub

    B tree, B+ tree and B* tree

    Stub, Nov 12, 2003, in forum: C Programming
    Replies:
    3
    Views:
    10,243
  2. Chris Fogelklou
    Replies:
    36
    Views:
    1,444
    Chris Fogelklou
    Apr 20, 2004
  3. Bob Nelson

    doubt about doubt

    Bob Nelson, Jul 28, 2006, in forum: C Programming
    Replies:
    11
    Views:
    660
  4. Replies:
    0
    Views:
    593
  5. Peter Otten
    Replies:
    2
    Views:
    139
    Cousin Stanley
    Aug 10, 2013
Loading...

Share This Page