0
[待解决问题]

# include <string.h>

typedef int DataType; /数据类型/
typedef int ElemType; /元素类型/
//----------------线性列表存储结构----------------
typedef struct LNode
{
ElemType data;
struct LNode next;
}LNode,
//创建含有n个结点的链表
{
int i;
p = L;
for(i = 0 ; i < n; i++)
{
scanf("%d", &q->data);
q->next = NULL;
p->next = q; //前后结点链接
p = q;
}
}
{
LinkList pa = La->next, pb = Lb->next;
while(pa && pb)
{
if(pa->data <= pb->data)
{
pc ->next = pa;
pc = pa;
pa = pa->next;
}
else
{
pc->next = pb;
pc = pb;
pb = pb->next;
}
}
pc->next = pa?pa:pb; //插入剩余段
free(La);
free(Lb);
}
{
while(p->next)
{
p = p->next;
printf("%d\n", p->data);
}
}
int main()
{
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
LNode La, Lb, Lc;
ListCreate(&La, a);
ListCreate(&Lb, b);
ListCreate(&Lc, c);
pa = La.next, pb = Lb.next, pc = Lc.next;
pre = &La;
//遍历pa，删除三个表中相同的结点
while(pa)
{
//分别在Lb和Lc中找到第一个大于等于pa的结点
while(pc && pb &&(pb->data<pa->data || pc->data<pa->data))
{
if(pb->data < pa->data)
pb = pb->next;
if(pc->data<pa->data)
pc = pc->next;
}
//Lb或Lc遍历完，停止遍历pa
if(!pb || !pc)
break;
if(pb->data == pa->data && pc->data == pa->data)
{
//pre所指结点的指针向后移动，pre指针本身不移动
pre->next = pa->next;
pa = pa->next;
free(temp);
}
else
{
pre = pa;
pa = pa->next;
}
}
ListTraverse(&La);
return 0;
}

0

您需要登录以后才能回答，未注册用户请先注册