Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25
  1. #21
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Trees Insert Method

    IOW: find the parent node(s) everywhere in the tree; if it doesn't/they don't contain the child yet, add it.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  2. #22
    Malv is offline Member
    Join Date
    Jun 2013
    Posts
    62
    Rep Power
    0

    Default Re: Trees Insert Method

    Quote Originally Posted by JosAH View Post
    IOW: find the parent node(s) everywhere in the tree; if it doesn't/they don't contain the child yet, add it.

    Jos
    oh okay understood.

    if i were to restrict duplications.
    for example i inserted (1,4) , (1,3), (3,3), (3,5)

    if i were to insert (1,4) again it will be duplicated thus cannot be insert.

    How do i go upon restricting this?

  3. #23
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Trees Insert Method

    Quote Originally Posted by Malv View Post
    oh okay understood.

    if i were to restrict duplications.
    for example i inserted (1,4) , (1,3), (3,3), (3,5)

    if i were to insert (1,4) again it will be duplicated thus cannot be insert.

    How do i go upon restricting this?
    reread the last phrase of my previous reply: if it doesn't/they don't contain the child yet, add it.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #24
    Malv is offline Member
    Join Date
    Jun 2013
    Posts
    62
    Rep Power
    0

    Default Re: Trees Insert Method

    Quote Originally Posted by JosAH View Post
    reread the last phrase of my previous reply: if it doesn't/they don't contain the child yet, add it.

    Jos
    What I mean was if I add a pair of parentchild which is 1,4 , 1,3 , 3,3 , 3,5 . I can't add in another 1,4 or 3,5 already. Not the child and parent separated meaning.

  5. #25
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Trees Insert Method

    Quote Originally Posted by Malv View Post
    What I mean was if I add a pair of parentchild which is 1,4 , 1,3 , 3,3 , 3,5 . I can't add in another 1,4 or 3,5 already. Not the child and parent separated meaning.
    Of course you can't do that; according to your own rules.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Help with binary trees please
    By sim18 in forum New To Java
    Replies: 3
    Last Post: 11-27-2012, 08:34 PM
  2. Replies: 7
    Last Post: 12-03-2011, 05:25 AM
  3. Need help with Trees...(8-puzzle)
    By ventrue in forum New To Java
    Replies: 2
    Last Post: 03-24-2009, 12:04 AM
  4. Replies: 3
    Last Post: 02-28-2009, 10:17 AM
  5. Insert() Method Help
    By VinceGuad in forum New To Java
    Replies: 7
    Last Post: 02-26-2009, 06:19 AM

Posting Permissions

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