Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can anyone explain me linked list for adding,deleting,display,adding and deleting front and end and middle and after even or odd positions,Traversing
Posted

 
Share this answer
 
Before writing a program, the first step would be to understand a linked list.
A linked list is a list where each item knows the location of the next node.
So essentially, there are two items in each item of a list, the data and a pointer to the next node.

Now, when you think about adding, updating or deleting an item, you need to take care of this pointer as well.
E.g.
A -> B -> C -> D

If you delete D, you do it in two steps, updating B's pointer and then deleting C.
E.g.
A -> B  C ->  D
     |        |
      --------

becomes
A -> B -> D

You can now start to think about other scenarios as well for e.g. traversing every odd item etc.

If you understand the concepts and are familiar with the programming language, you should not face many challenges in writing code for operations on linked lists.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900