-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkedlist.h
34 lines (30 loc) · 869 Bytes
/
linkedlist.h
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
/**
* Type alias for the internal representation of linkedlist.
* Defined in linkedlist.c:
*
* struct linkedlist {
* ...
* }
*
* And later reference this struct type using linkedlist_t.
*/
typedef struct linkedlist linkedlist_t;
typedef struct linkedlist_node linkedlist_node_t;
/**
* Return a pointer to a new linkedlist
*/
linkedlist_t *ll_init();
/**
* Add a mapping from key->value to the associative linkedlist.
* If a mapping with the given key already exists, replace the value.
*/
void ll_add(linkedlist_t *list, int key, int value);
/**
* Retrieves the value associated with the given key from the linkedlist.
* If the key does not exist in the linkedlist, return 0.
*/
int ll_get(linkedlist_t *list, int key);
/**
* Returns the number of unique key->value mappings in the linkedlist.
*/
int ll_size(linkedlist_t *list);