#include
#include
#include
#define len sizeof(struct student)
struct student
;int n; //全域性變數n、用記錄鍊錶的結點數.
struct student *creat(void); //建立鍊錶的函式原型宣告.
void print(struct student *head); //輸出鍊錶的函式原型宣告.
struct student *merge(struct student *la,struct student *lb); //對兩個帶有頭結點鍊錶的函式宣告.
int main()
struct student *creat(void)
p2->next=null;
free(p1);
return(head);
}void print(struct student *head)
while(p!=null);}}
struct student *merge(struct student *la,struct student *lb) //該**是根據學生的學號來排序的.
else
}if(a!=null) c->next=a;
else c->next=b;
free(lb);
return la;
}
兩個公升序鍊錶合併成乙個公升序鍊錶
將兩個公升序鍊錶和並成乙個公升序序列 include includetypedef struct node linknode linknode creat linklist2 return h void printlink linknode h linknode mergelink linknode...
兩個公升序鍊錶合併為乙個公升序鍊錶
linklist mergeheaderlinklist linklist l,linklist p else while header2 next null if header1 next null printf 找到比 d大的值 d n header2 next data,header1 nex...
面試題 將兩個公升序排列的鍊錶合併成乙個公升序鍊錶
將兩個公升序排列的鍊錶合併成乙個有序鍊錶 例如 head1 2 3 5 6 7 9 11 head2 2 4 5 7 9 合併之後結果為 head 2 2 3 4 5 5 6 7 7 9 9 11 如下 設head1和head2是兩個非空單向鍊錶,資料值有重複且公升序排序 將head1和head2合...