-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlist.h
More file actions
61 lines (52 loc) · 1.32 KB
/
list.h
File metadata and controls
61 lines (52 loc) · 1.32 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
/**
* Allyson Schrader amschrad@ucsc.edu
* List.h
* CMPS101 PA5
* 5.29.08
*/
#if !defined(_LIST_H_INCLUDE_)
#define _LIST_H_INCLUDE_
typedef enum {FALSE = (0!=0), TRUE = (0==0)} bool;
typedef struct Node{
int data;
struct Node* next;
struct Node* prev;
} Node, * NodeRef;
typedef struct List{
NodeRef front;
NodeRef rear;
NodeRef curr;
int length;
} List, *ListRef;
/*** Constructors-Destructors ***/
ListRef newList(void);
void freeList(ListRef* pL);
/*** Access functions ***/
int isEmpty(ListRef L);
int offEnd(ListRef L);
int atFirst(ListRef L);
int atLast(ListRef L);
int getFirst(ListRef L);
int getLast(ListRef L);
int getCurrent(ListRef L);
int getLength(ListRef L);
int equals(ListRef A, ListRef B);
/*** Manipulation procedures ***/
void makeEmpty(ListRef L);
void moveFirst(ListRef L);
void moveLast(ListRef L);
void movePrev(ListRef L);
void moveNext(ListRef L);
void insertBeforeFirst(ListRef L, int data);
void insertAfterLast(ListRef L, int data);
void insertBeforeCurrent(ListRef L, int data);
void insertAfterCurrent(ListRef L, int data);
void insertInOrder(ListRef L, int data);
void deleteFirst(ListRef L);
void deleteLast(ListRef L);
void deleteCurrent(ListRef L);
void makeListNull(ListRef L);
/*** Other operations ***/
void printList(FILE* out, ListRef L);
ListRef copyList(ListRef L);
#endif