1、使用
while(p1&&p2)
{
内容;
}
对两个链表进行比较相加比
while(p1)
{
while(p2)
{
内容;
}
}
更加的直观.
相加时尽量不要破坏第二个链表p2,复制链表元素添加到p1中比较好。
1、使用
while(p1&&p2)
{
内容;
}
对两个链表进行比较相加比
while(p1)
{
while(p2)
{
内容;
}
}
更加的直观.
相加时尽量不要破坏第二个链表p2,复制链表元素添加到p1中比较好。