自己写的可以删除链表中重复元素的函数:
template <typename ElemType>
Status LinkList<ElemType>::deleteElem(ElemType e)
{
NodePointer p,r,q;
r=NULL;
p=head;
while (p)
{
if(equal(p->data,e))
{
if(p==head)
head=p->next;
else
r->next=p->next;
p=p->next;
}
else
{
r=p;
p=p->next;
}
}
if(p==NULL&&r==NULL)
return ERROR;
else
{
delete p;
return OK;}
}