vendredi 27 février 2015

Remove duplicates in Linked List


Vote count:

0




I dont know whats wrong with my code. Also, how would you delete a node in the linked list.



for(IntNode * i=head;i!=0; i=i->next){
IntNode * prev=i;
for(IntNode * j=i->next; j!=0; j=j->next){
if(j->data==i->data){
IntNode *temp=j;
prev->next=j->next;
delete temp;
}
prev=prev->next;
}
}


asked 33 secs ago







Remove duplicates in Linked List

Aucun commentaire:

Enregistrer un commentaire