help me with java linkedList problem!

P

perl.jsp

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

Oliver Wong

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top