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. Advertising

  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. 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. Sharp
    Replies:
    4
    Views:
    14,257
    tennenrishin
    Jul 5, 2011
  2. Replies:
    9
    Views:
    1,125
    Mike Schilling
    Oct 29, 2009
  3. Replies:
    9
    Views:
    440
    Mike Schilling
    Oct 29, 2009
  4. Lew
    Replies:
    0
    Views:
    367
  5. Sebastian
    Replies:
    7
    Views:
    2,957
    Roedy Green
    Nov 26, 2010
Loading...

Share This Page