commit
23db1b897c
25
list/list.h
25
list/list.h
@ -1,15 +1,15 @@
|
|||||||
typedef struct Node{
|
typedef struct Node{
|
||||||
unsigned long int id;
|
unsigned long int id;//what's this?
|
||||||
void *value;
|
void *value;
|
||||||
struct Node *next;
|
Node *next;
|
||||||
struct Node *front;
|
Node *last;
|
||||||
} Node;
|
};
|
||||||
|
|
||||||
typedef struct List{
|
typedef struct List{
|
||||||
Node *head;
|
Node *head;
|
||||||
Node *tail;
|
Node *tail;
|
||||||
unsigned long int length;
|
unsigned long int length;
|
||||||
} List;
|
};
|
||||||
|
|
||||||
List *init_list();
|
List *init_list();
|
||||||
Node *init_node();
|
Node *init_node();
|
||||||
@ -22,3 +22,18 @@ int popFromTail(List *p_list);
|
|||||||
unsigned long int len(List *p_list);
|
unsigned long int len(List *p_list);
|
||||||
Node *findById(List *p_list, unsigned long int id);
|
Node *findById(List *p_list, unsigned long int id);
|
||||||
Node *findByValue(List *p_list, char type[], void *value);
|
Node *findByValue(List *p_list, char type[], void *value);
|
||||||
|
|
||||||
|
|
||||||
|
int insertInHead(List *p_list, Node *p_node){
|
||||||
|
p_list->head->last = p_node;
|
||||||
|
//p_node->last = NULL;
|
||||||
|
p_node->next = p_list->head;
|
||||||
|
p_list->head = p_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
int insertInTail(List *p_list, Node *p_node){
|
||||||
|
p_list->tail->next = p_node;
|
||||||
|
//p_node->next = NULL;
|
||||||
|
p_node->last = p_list->tail;
|
||||||
|
p_list->tail = p_node;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user