-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathskiplist_list.c
More file actions
33 lines (22 loc) · 744 Bytes
/
Copy pathskiplist_list.c
File metadata and controls
33 lines (22 loc) · 744 Bytes
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
#include <stdio.h>
#include "skiplist_list.h"
SKIPLIST_LIST_DECL(int)
void skiplist_list_test() {
SKIPLIST_LIST(int) sl_int;
SKIPLIST_LIST_INIT(int)(&sl_int);
for(int i=0; i<20; i++)
SKIPLIST_LIST_ADD(int)(&sl_int, i, i*2);
for(int i=0; i<20; i++)
SKIPLIST_LIST_ADD(int)(&sl_int, i*2+1, -(i*2+1));
for(int i=0; i<40; i++)
printf("%d ", SKIPLIST_LIST_GET(int)(&sl_int, i));
putchar('\n');
for(int i=0; i<40; i++)
printf("%d ", SKIPLIST_LIST_REMOVE(int)(&sl_int, 0));
putchar('\n');
for(int i=0; i<20; i++)
SKIPLIST_LIST_PUSH_BACK(int)(&sl_int, i);
for(int i=0; i<20; i++)
printf("%d ", SKIPLIST_LIST_POP_BACK(int)(&sl_int));
printf("\n\n");
}