实验二
1. 主函数:
#include<iostream>
#include<ctime>
#include<string>
using namespace std;
#include "d_node.h"
#include "function.h"
int main()
{
node<int> * L1 = initRandom(); //初始化随机链表
cout << "The random list 1 as followed:" << endl;
writeLinkedList(L1);
sort(L1); //对随机链表 L1 进行排序
cout << "The state of list 1 after sorted:" << endl;
writeLinkedList(L1);
node<int> * L2 = initRandom();
cout << "The random list 2 as followed:" << endl;
writeLinkedList(L2);
sort(L2);
cout << "The state of list 2 after sorted:" << endl;
writeLinkedList(L2);
emerge(L1,L2); //合并二个有序链表 L1,L2
cout << "The state of list after emerged:" << endl;
writeLinkedList(L1);
return 0;
}