与本题类似的其它几个题解答如下
() 解答完全同上
() 本题是求交集即只有同时出现在两集合中的元素才出现在结果表中其核心语句段如下
pa=la>next;pb=lb>next;∥设工作指针pa和pb;
pc=la;∥结果表中当前合并结点的前驱的指针
while(pa&&pb)
if(pa>data==pb>data)∥交集并入结果表中
{ pc>next=pa;pc=pa;pa=pa>next;
u=pb;pb=pb>next;free(u);}
else if(pa>data<pb>data) {u=pa;pa=pa>next;free(u);}
else {u=pb; pb=pb>next; free(u);}
while(pa){ u=pa; pa=pa>next; free(u);}∥ 释放结点空间
while(pb) {u=pb; pb=pb>next; free(u);}∥释放结点空间
pc>next=null;∥置链表尾标记
free(lb);∥注 本算法中也可对B表不作释放空间的处理
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []