資源簡介
實現兩個有序單鏈表的合并。要求:隨機創建兩個單鏈表,實現單鏈表的排序,再對兩個有序單鏈表進行合并。

代碼片段和文件信息
#include
#include
#include
using?namespace?std;
#include?“d_node.h“
#include?“function.h“?
int?main()
{
node?*?L1?=?initRandom(); //初始化隨機鏈表
cout?<“The?random?list?1?as?followed:“?< writelinkedList(L1);
sort(L1); //對隨機鏈表L1進行排序
cout?<“The?state?of?list?1?after?sorted:“?< writelinkedList(L1);
node?*?L2?=?initRandom();
cout?<“The?random?list?2?as?followed:“?< writelinkedList(L2);
sort(L2);
cout?<“The?state?of?list?2?after?sorted:“?< writelinkedList(L2);
emerge(L1L2); //合并二個有序鏈表L1L2
cout?<“The?state?of?list?after?emerged:“?< writelinkedList(L1);
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????727??2012-03-06?11:27??exp_2\combination.cpp
?????文件????????605??2012-03-02?20:14??exp_2\d_node.h
?????文件???????4396??2012-03-04?00:05??exp_2\exp_2.dsp
?????文件????????535??2012-03-03?14:43??exp_2\exp_2.dsw
?????文件??????50176??2012-03-06?11:29??exp_2\exp_2.ncb
?????文件??????48640??2012-03-06?11:29??exp_2\exp_2.opt
?????文件????????888??2012-03-06?11:27??exp_2\exp_2.plg
?????文件???????3350??2012-03-06?11:27??exp_2\function.h
?????文件?????114688??2012-03-06?11:25??實驗二.doc
?????目錄??????????0??2012-03-06?11:31??exp_2
-----------?---------??----------?-----??----
???????????????224005????????????????????10
- 上一篇:米氏理論經典版--包括計算方法
- 下一篇:sobel算子的verilog實現
評論
共有 條評論