-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdoublyLinkedList.h
More file actions
96 lines (80 loc) · 1.8 KB
/
doublyLinkedList.h
File metadata and controls
96 lines (80 loc) · 1.8 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef __DOUBLYLINKEDLIST_H
#define __DOUBLYLINKEDLIST_H
typedef void* DoublyLinkedList;
typedef void* Info;
typedef void* Node;
/*
Instancia uma nova lista (malloc e retorna o void*)
POS: pointer da lista
*/
DoublyLinkedList create();
/*
Adiciona um novo Node na lista com Info
PRE: DoublyLinkedList lista e Info info
*/
void insert(DoublyLinkedList lista, Info info);
/*
Retorna o numero de nodes da lista
*/
int getSize(DoublyLinkedList lista);
/*
Retorna 1 se a lista estiver vazia e 0 se não estiver
*/
int isEmpty(DoublyLinkedList lista);
/*
Retorna a informação dentro do index i
PRE: lista e int i
POS: informação (NULL se for outofboudaries exception)
*/
Info getInfoByIndex(DoublyLinkedList lista, int i);
/*
Retorna a Info do Node
PRE: Node node
POS: Info info
*/
Info getInfo(Node node);
/*
Retorna o 1º Node da lista
PRE: DoublyLinkedList lista
POS: Node node
*/
Node getFirst(DoublyLinkedList lista);
/*
Retorna o último Node da lista
PRE: DoublyLinkedList lista
POS: Node node
*/
Node getLast(DoublyLinkedList lista);
/*
Retorna o elemento anterior de um Node
PRE: Node node
POS: Node node
*/
Node getPrevious(Node node);
/*
Retorna o próximo elemento de um Node
PRE: Node node
POS: Node node
*/
Node getNext(Node node);
/*
Insere um elemento antes do elemento passado
PRE: DoublyLinkedList lista, Node node, Info info
*/
void insertBefore(DoublyLinkedList lista, Node node, Info info);
/*
Insere um elemento depois do elemento passado
PRE: DoublyLinkedList lista, Node node, Info info
*/
void insertAfter(DoublyLinkedList lista, Node node, Info info);
/*
Remove o Node especificado da lista
PRE: DoublyLinkedList lista, Node node
*/
void removeNode(DoublyLinkedList lista, Node node, int flag);
/*
Remove uma lista
PRE: DoublyLinkedList lista
*/
void removeList(DoublyLinkedList lista, int flag);
#endif