首先,三个表是有序的,要删除的实际是ai = bj = ck
三个元素不相等,可能出现的是ai<bj 或者bj<ck 或者ck<ai
void Difference_L(LinkList &a,LinkList &b,LinkList Lc)
{
pre = pa;//删除a表元素,必须记录元素前驱
pa = La->next; pb = Lb->next;pc = Lc->next;
while(pa&&pb&&pc)
{
if(pa->data<pb->data){pre = pa;pa = pa->next;}
else if(pb->data<pc->data) pb =pb->next;
else if(pc->data<pa->data) pc = pc->next;
else{
pre->next = pa->next; delete pa; pa = pre ->next;
}
}
}
温馨提示:答案为网友推荐,仅供参考