Linked Lists2 - While(current!=NULL&&...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Linked Lists –2 { listNode *previous = NULL; listNode *current = head; while (current!=NULL){ previous=current; current = current -> next; delete previous; } head=NULL; } { ListNode *previous = NULL; ListNode *current = head;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: While (current!=NULL && current->data!=key) { Previous=current; Current=current->next; } if(current !=NULL) //element to be deleted was found { if(current==head) head=head->next; else previous->next=current->next; delete current; } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online