Results 1 to 3 of 3

Thread: Inserting Nodes

  1. #1
    myst is offline Member
    Join Date
    May 2010
    Posts
    44
    Rep Power
    0

    Default Inserting Nodes

    Let's say we have

    Java Code:
    next     next          next
    100      200          400
    and i want to insert 300 in the correct position. Why can't I make 200's next point to 300, and then make 300's next point to 400?

    (rather then making 300's next point to 400, and then making 200's next point to 300)

    Or can I??

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by myst View Post
    Let's say we have

    Java Code:
    next     next          next
    100      200          400
    and i want to insert 300 in the correct position. Why can't I make 200's next point to 300, and then make 300's next point to 400?

    (rather then making 300's next point to 400, and then making 200's next point to 300)

    Or can I??
    If you first make 200's next point to 300 you lose the old reference to 400 ...

    kind regards,

    Jos

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,318
    Rep Power
    25

    Default

    Why can't I make 200's next point to 300, and then make 300's next point to 400?
    You could as long as you save a pointer to 400 before you change 200's pointer to be a pointer to 300.

Similar Threads

  1. Problem with Nodes - need help!
    By Smithy in forum New To Java
    Replies: 3
    Last Post: 03-20-2010, 03:47 PM
  2. nodes
    By Dr Gonzo in forum New To Java
    Replies: 1
    Last Post: 12-08-2008, 04:22 PM
  3. Nodes displayed in JTree
    By Orange in forum AWT / Swing
    Replies: 6
    Last Post: 08-08-2008, 05:07 AM
  4. nodes in java netowork
    By ahsan in forum Advanced Java
    Replies: 0
    Last Post: 12-26-2007, 03:11 PM
  5. nodes in java
    By ahsan in forum New To Java
    Replies: 0
    Last Post: 12-26-2007, 03:09 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
  •