-
Notifications
You must be signed in to change notification settings - Fork 0
/
listmain.c
52 lines (49 loc) · 1.05 KB
/
listmain.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
#include<stdio.h>
#include "list.h"
#include <stdbool.h>
int main(){
list L1;
init(&L1);
insert_end(&L1, 1);
insert_end(&L1, 2);
insert_end(&L1, 3);
insert_end(&L1, 4);
traverse(L1);
printf("\n");
insert_beg(&L1,7);
traverse(L1);
printf("\n");
delete_beg(&L1);
traverse(L1);
printf("\n");
delete_end(&L1);
traverse(L1);
printf("\n");
printf("%d\n", len(L1));
insert_end(&L1, 1);
insert_end(&L1, 2);
insert_end(&L1, 3);
insert_end(&L1, 4);
insert_end(&L1, 5);
traverse(L1);
printf("\n");
insert_at_post(&L1, 3, 11);
traverse(L1);
printf("\n");
delete_by_value(&L1, 3);
traverse(L1);
printf("\n");
delet_at_index(&L1, 2);
traverse(L1);
printf("\n");
insert_at_post(&L1, 3, 11);
traverse(L1);
printf("\n");
sort(&L1);
traverse(L1);
printf("\n");
printf("%d\n", len(L1));
printf("%d\n",cheak_if_present(L1, 5));
printf("%d\n",findMiddle(L1)->data);
return 0;
}