Skip to content

Instantly share code, notes, and snippets.

@songpu2015617
Created April 15, 2015 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save songpu2015617/767122161cdf0f583ddc to your computer and use it in GitHub Desktop.
Save songpu2015617/767122161cdf0f583ddc to your computer and use it in GitHub Desktop.
cc150 2.1
#include <iostream>
void duplicate_list(node *head){
if(head==NULL) return;
node *p, *q, *c=head;
while(c){
p=c; q=c->next;
int d = c->data;
while(q){
if(q->data==d){
node *t = q;
p->next = q->next;
q = p->next;
delete t;
}
else{
p = q; q = q->next;
}
}
c = c->next;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment