mirror of
https://github.com/Didnelpsun/CS408.git
synced 2026-06-17 15:37:31 +08:00
更新数据结构
This commit is contained in:
@@ -1,40 +1,32 @@
|
||||
// ²âÊÔÎļþ
|
||||
// 测试文件
|
||||
|
||||
#include "../head/sequence_list.h"
|
||||
#include "../head/link_list.h"
|
||||
|
||||
int SequenceListTest() {
|
||||
DynamicSequenceList list;
|
||||
list.Insert(0, 'a');
|
||||
element_type a[6] = {'1','2','3','4','5','6'};
|
||||
list.LoopInsert(a, 0, 6);
|
||||
//printf("%c", list.data[2]);
|
||||
element_type b[3] = { '9', 'a', 'e' };
|
||||
list.LoopInsert(b, 1, 2);
|
||||
list.Printf();
|
||||
/*list.Printf();
|
||||
printf("\n");
|
||||
int len = 2;
|
||||
element_type elem[2];
|
||||
list.MultiDelete(0, len, elem);*/
|
||||
/*list.Printf();
|
||||
for (int i = 0; i < len; i++) {
|
||||
printf("%c\n", elem[i]);
|
||||
}*/
|
||||
/*DynamicSequenceList dlist;
|
||||
InitDynamicSequenceList(&dlist);
|
||||
OtherIncreaseDynamicSequenceList(&dlist, 15);
|
||||
printf("%d", dlist.max_size);*/
|
||||
int index = list.Locate('5');
|
||||
index = list.GetElem(1);
|
||||
cout << list.Empty() << endl;
|
||||
list.Print();
|
||||
element_type b[4];
|
||||
list.LoopDelete(1, 3, b);
|
||||
list.Print();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
cout << b[i] << endl;
|
||||
}
|
||||
list.Destroy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinkListTest() {
|
||||
LinkList list;
|
||||
cout << list.Empty() << endl;
|
||||
LinkListWithHead list;
|
||||
//cout << list.Empty() << endl;
|
||||
//element_type a[6] = { '1','2','3','4','5','6' };
|
||||
//list.LoopInsert(a, 1, 6);
|
||||
list.Insert(1, '3');
|
||||
list.Print();
|
||||
list.Insert(2, '4');
|
||||
list.Print();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user