/*归并法:用于合并两个链表*/
/*
* SCs in different cases
* author: Whywait
*/
typedef struct node {
Elemtype data;
struct node* next;
} Lnode;
/*case ONE*/
Lnode* merge1(Linklist& LA, Linklist& LB) {
// merge two sorted Singly linked lists
// LA, LB and the return one ( LC ) all have a head node
// all the linklist are sorted in the same way: increasing or decreasing
// we assume that all the slists are sorted in an increasing order
// KEY: insert in the tail
Lnode* LC = (Lnode*)malloc(sizeof(Lnode));
LC->next = NULL;
链表必学算法(三):归并法
最新推荐文章于 2021-07-05 20:48:01 发布