Data structure expriment 1
list.h
Go to the documentation of this file.
1 
7 #include <stdlib.h>
8 #ifndef EXPERIMENT1_LIST_H
9 #define EXPERIMENT1_LIST_H
10 
11 typedef struct st_people{
12  int id;
13  struct st_people *next;
14  struct st_people *prev;
15 }People;
16 
18 typedef struct st_list{
22 }List;
23 
28 People *malloc_l(List *list);
29 
34 void free_l(List *list,People *now);
35 
36 
41 List *init(int reserve);
42 
47 List *destroy(List *list);
48 
53 List *create_list(int id);
54 
62 People *insert(List *list, People *now, int id);
63 
70 People *delete(List *list, People *dying);
71 
72 #endif //EXPERIMENT1_LIST_H
init
List * init(int reserve)
Definition: list.c:82
st_list::head
People * head
标记链表头位置
Definition: list.h:21
destroy
List * destroy(List *list)
Definition: list.c:103
insert
People * insert(List *list, People *now, int id)
Definition: list.c:31
free_l
void free_l(List *list, People *now)
Definition: list.c:20
st_people::prev
struct st_people * prev
后一个节点
Definition: list.h:14
st_list
Definition: list.h:18
st_people::next
struct st_people * next
前一个节点
Definition: list.h:13
st_people::id
int id
人员号
Definition: list.h:12
init
List * init(int reserve)
Definition: list.c:82
create_list
List * create_list(int id)
Definition: list.c:73
malloc_l
People * malloc_l(List *list)
Definition: list.c:11
destroy
List * destroy(List *list)
Definition: list.c:103
st_list::data
People * data
人员节点数组,可看做内存
Definition: list.h:19
free_l
void free_l(List *list, People *now)
Definition: list.c:20
st_list::available
People * available
标记数组中第一个空节点的位置
Definition: list.h:20
People
struct st_people People
create_list
List * create_list(int n)
Definition: list.c:73
List
struct st_list List
list.h
静态双向链表的基本定义
st_people
Definition: list.h:11
malloc_l
People * malloc_l(List *list)
Definition: list.c:11
insert
People * insert(List *list, People *now, int id)
Definition: list.c:31