1.ds
链表头及链表节点
struct list_head{
struct list_head *prev, *next;
}
2.init
static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
3.添加的节点
A.双向循环列表:若只有Head 和 AddNode,需要注意断链问题,即Head的后续不能丢。
B.双向循环链表:可把head的next同时取出来,转化成:pre,new,next,防止断链问题。
4.哨兵
哨兵节点:用来减少对头节点和尾节点的特殊处理。