typedef struct node
{
int data;
struct node *next;
} LNode, *LinkList;
LinkList Unions(LinkList la, LinkList lb)
{
LNode *p, *q, *w, *u;
p = la->next;
q = lb->next;
w = la;
while (p && q)
{
if (p->data == q->data)
{
w->next = p;
w = w->next;
p = p->next;
u = q;
q = q->next;
free(u);
}
else if (p->data < q->data)
{
u = p;
p = p->next;
free(u);
}
else
{
u = q;
q = q->next;
free(q);
}
}
if (q)
{
p = q;
}
while (q)
{
u = q;
q = q->next;
free(u);
}
w->next = NULL;
free(lb);
return la;
}
Read More:
- 【Hackerrank】Reverse a doubly linked list
- 206. Reverse Linked List [easy] (Python)
- Leetcode-234: palindrome linked list
- JMeter linked database
- 21. Merge Two Sorted Lists [easy] (Python)
- LeetCode 23. Merge k Sorted Lists(java)
- The solution of Hibernate query returning all null lists
- Reading package lists… Error! (How to Fix)
- The sum of the two numbers of leetcode
- Solve the error of clearing data in object.assign in Vue
- Compare whether two sets are the same in Java
- Two lines of code to solve your vs flashback problem
- Cannot assign requested address error resolution
- The value of adding two fields of MySQL
- new_lrs[:5] = lr_warm [12] TypeError: can only assign an iterable
- Firefox: How to Solve “Network Protocol Error” (Two Methods)
- Arrow function should not return assignment no-return-assign
- Two solutions to Cannot load module file xxx.iml
- Solution to the segmentation fault of single chain table in C language
- Using JSTL to traverse the list set reports an error