- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello! (Smile)
I want to implement the algorithm [m]Delete()[/m] for linked lists.
That's what I have tried:
Could you tell me if it is right or if I have done something wrong? (Thinking)
I want to implement the algorithm [m]Delete()[/m] for linked lists.
That's what I have tried:
Code:
void Delete(pointer L,Type x){
if (L==NULL){
printf("There is no element x in the list. \n");
return;
}
pointer q=L;
while (q!=NULL && q->next->data!=x)
q=q->next;
q->next=q->next->next;
}
Could you tell me if it is right or if I have done something wrong? (Thinking)