Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By doWhile

Thread: Should a 234 tree Nodes link to their parent as well as their children?

  1. #1
    taleman is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default Should a 234 tree Nodes link to their parent as well as their children?

    When Implementing a 234 tree should the Nodes link to their parent as well as their children or should they link only to their children? I know that how i do it is ultimately up to me. But in practice (in your experience) do they normally link back to their parent?

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Should a 234 tree Nodes link to their parent as well as their children?

    DarrylBurke likes this.

  3. #3
    taleman is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default Re: Should a 234 tree Nodes link to their parent as well as their children?

    Sorry I didn't realize cross posting was prohibited, I guess now I know.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,344
    Blog Entries
    7
    Rep Power
    20

    Default Re: Should a 234 tree Nodes link to their parent as well as their children?

    When you traverse the tree downwards (i.e. away from the root) you can push the visited nodes on a stack; that way you don't need to keep pointers to the parents when you want to crawl back again (i.e. towards the root). But it doesn't harm to store a parent pointer in each node.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    taleman is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default Re: Should a 234 tree Nodes link to their parent as well as their children?

    Quote Originally Posted by JosAH View Post
    When you traverse the tree downwards (i.e. away from the root) you can push the visited nodes on a stack; that way you don't need to keep pointers to the parents when you want to crawl back again (i.e. towards the root). But it doesn't harm to store a parent pointer in each node.

    kind regards,

    Jos
    That is next level genius!!!... all joking aside that actually sound like a really good solution. Thanks, I don't think I would of thought of that on my own.

Similar Threads

  1. Replies: 0
    Last Post: 11-29-2010, 01:27 AM
  2. How to keep track of nodes in a tree?
    By ryuzog in forum New To Java
    Replies: 2
    Last Post: 11-25-2010, 11:30 PM
  3. Replies: 2
    Last Post: 11-09-2010, 01:34 PM
  4. Adding/removing nodes to tree under TreeViewer
    By Rodrigo Braz in forum SWT / JFace
    Replies: 0
    Last Post: 04-20-2009, 01:02 AM
  5. Replies: 2
    Last Post: 12-12-2008, 10:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •