views:

17

answers:

2
+1  Q: 

LinkList Pointer

I have a linklist A->B->C->D my head pointer is on A i want to delete node c with only one head pointer. i dont want any code just explanation.

+1  A: 

Delete node C and make B->next to D.

When traversing the list you probably want to store the previous node in a variable, so when you hit C, you set the prev node's (which is B) next to D.

Tuomas Pelkonen
how to delete c just one pointer.that is on A node
hasnain raza
delete A->next->next;A->next->next = D;Now the list will be A->B->D
Tuomas Pelkonen
A: 

You walk the list, keep both the node you are currently looking at, and the previous one. When you find the node you want to delete, you change the link in the previous node to point to the next node.

You need to special case if you end up wanting to delete the head node as well.

Douglas Leeder