help me with java linkedList problem!

Discussion in 'Java' started by perl.jsp@gmail.com, Jun 12, 2006.

  1. Guest

    there are a few sentences on how to insert a node into a
    linkedList,delete a node from a linkedList:
    1.insert a node at the beginning of a linkedList:
    NewList.Next[NewNode]=Pointer
    HEAD=NewNode
    2.insert a node into the middle of a linkedList:
    NewList.Next[NewNode]=NewList.Next[Pointer]
    NewList.Next[Pointer]=NewNode
    3. insert a node at the tail of linkedList:
    NewList.Next[NewNode]=NewList.Next[Pointer]
    NewList.Next[Pointer]=NewNode

    delete a node from a linkedList:
    1.delete a node from the beginning of a linkedList:
    Header=NewList.Next[Pointer];
    NewList.Next[Pointer]=-2;
    2.delete a node from the middle of a linkedList:
    NewList.Next[Back]=NewList.Next[pointer];
    NewList.Next[Pointer]=-2;
    3.delete a node from the tail of a linkedList;
    NewList.Next[Back]=NewList.Next[pointer];
    NewList.Next[Pointer]=-2;
    i can't understand the text above. i just copy it from my book. can
    someone give me some explanation about the above text. thanks in
    advance.
     
    , Jun 12, 2006
    #1
    1. Advertisements

  2. Oliver Wong Guest

    <> wrote in message
    news:...
    > there are a few sentences on how to insert a node into a
    > linkedList,delete a node from a linkedList:
    > 1.insert a node at the beginning of a linkedList:
    > NewList.Next[NewNode]=Pointer
    > HEAD=NewNode
    > 2.insert a node into the middle of a linkedList:
    > NewList.Next[NewNode]=NewList.Next[Pointer]
    > NewList.Next[Pointer]=NewNode
    > 3. insert a node at the tail of linkedList:
    > NewList.Next[NewNode]=NewList.Next[Pointer]
    > NewList.Next[Pointer]=NewNode
    >
    > delete a node from a linkedList:
    > 1.delete a node from the beginning of a linkedList:
    > Header=NewList.Next[Pointer];
    > NewList.Next[Pointer]=-2;
    > 2.delete a node from the middle of a linkedList:
    > NewList.Next[Back]=NewList.Next[pointer];
    > NewList.Next[Pointer]=-2;
    > 3.delete a node from the tail of a linkedList;
    > NewList.Next[Back]=NewList.Next[pointer];
    > NewList.Next[Pointer]=-2;
    > i can't understand the text above. i just copy it from my book. can
    > someone give me some explanation about the above text. thanks in
    > advance.


    I'm having trouble understanding the above text as well. I don't know
    what the -2 literal is supposed to mean, for example.

    If you want to understand what Link Lists are and how they work, you
    might want to read this Wikipedia article:

    http://en.wikipedia.org/wiki/Linked_list

    - Oliver
     
    Oliver Wong, Jun 12, 2006
    #2
    1. Advertisements

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. Tohru Kao
    Replies:
    3
    Views:
    718
    Neil Masson
    Jul 14, 2003
  2. Tohru Kao
    Replies:
    1
    Views:
    623
    Chris
    Jul 8, 2003
  3. David
    Replies:
    4
    Views:
    883
    Jonathan Oexner
    Jul 31, 2003
  4. Anonymous Sender
    Replies:
    7
    Views:
    536
    Andrew Thompson
    May 25, 2004
  5. Sharp
    Replies:
    4
    Views:
    14,820
    tennenrishin
    Jul 5, 2011
  6. Replies:
    9
    Views:
    1,263
    Mike Schilling
    Oct 29, 2009
  7. Replies:
    9
    Views:
    584
    Mike Schilling
    Oct 29, 2009
  8. Sebastian
    Replies:
    7
    Views:
    3,606
    Roedy Green
    Nov 26, 2010
Loading...