-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
74 lines (50 loc) · 1.22 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <stdio.h>
#include <stdlib.h>
#include "SequenceList.h"
#include "linkedList.h"
#include "doublyLinkedList.h"
//主程序
int main() {
/*
//初始化线性表
struct SequenceList list;
if (initSequenceList(&list)) {
for (int i = 1; i <= 20; ++i)
insertSequenceListElement(&list, i, i);
printSequenceListInfo(&list);
}
else {
printf("顺序表初始化失败,无法启动程序!");
}
//插入操作
insertSequenceListElement(&list, 12365464, 5);
printSequenceListInfo(&list);
//删除操作
deleteSequenceListElement(&list, -1);
printSequenceListInfo(&list);
*/
/*
//初始化链表头节点
struct listNode head;
//初始化链表
initLinkedList(&head);
//插入操作
for (int i = 1; i <= 10; ++i) {
insertLinkedListElement(&head, i*100, i);
}
printLinkedListInfo(&head);
//删除操作
deleteLinkedListElement(&head, 5);
printLinkedListInfo(&head);
//访问元素
printf("访问的元素为:%d\n",getLinkedListElement(&head, 5));
//查找某元素在该链表第一次出现的位置
E element = 200;
printf("'%d'在该链表第一次出现的位置在: %d\n", element,findLinkedListElement(&head, element));
return 1;
*/
struct doublyListNode node;
initDoublyList(&node);
for (int i = 1; i < 5; ++i) //插5个元素吧
insertDoublyList(&node, i , i* 100);
}