-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinkedlist.h
More file actions
68 lines (44 loc) · 1.25 KB
/
Copy pathlinkedlist.h
File metadata and controls
68 lines (44 loc) · 1.25 KB
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
/**
* Generic Singly-Linked List ADT : public interface
* Node: One Node in a linked list
* LinkedList: A generic singly-linked list of data defined by gentype.h
*
* Author: Joseph Fall
* Date: Mar. 1, 2018
*/
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include "gentype.h"
/*******************
* PRIVATE TYPE DECLARATIONS
********************/
//----- NODE -----
struct Node {
ItemType data;
struct Node* next;
};
typedef struct Node Node_t;
Node_t* nodeCreate(ItemType value);
void nodePrint(Node_t node);
//----- LINKED LIST -----
struct LinkedList {
Node_t* head;
Node_t* tail;
};
typedef struct LinkedList LinkedList_t;
void llLinkAfter(LinkedList_t* list, Node_t* cursor, Node_t* newNode);
Node_t* llUnlinkAfter(LinkedList_t* list, Node_t* cursor);
/*********************
* PUBLIC INTERFACE
*********************/
LinkedList_t llCreate();
void llDestroy(LinkedList_t* list);
void llPrint(const LinkedList_t list);
bool llIsEmpty(const LinkedList_t list);
void llDelete(LinkedList_t* list);
int llLength(const LinkedList_t list);
void llPush(LinkedList_t* list, ItemType value);
void llAppend(LinkedList_t* list, ItemType value);
ItemType llHead(const LinkedList_t list);
ItemType llPop(LinkedList_t* list);
#endif