标签:
比如 1->2->2->3,删除重复后,变为1->3。
void delDup(Node* head) { Node node; node.next = head; Node* n1, n2; n1 = node; n2 = node->next; int data; while (n2) { data = n2->data; n2 = n2->next; if (n2 && n2->data == data) { n2 = n2->next; } else { if (n1->next->next == n2) { n1 = n1->next; } else { n1->next = n2; } } } head = node.next; }
标签:
原文地址:http://www.cnblogs.com/litao-tech/p/4330147.html