大话数据结构---双向链表的插入与删除
程序员文章站
2022-03-22 19:55:58
...
双向链表的插入
typedef struct DulNude
{
ElemType data;
struct DulNode *prior; /*前驱指针*/
struct DulNode *next; /*后继指针*/
} DulNode, *DuLinkList;
/*p和p->next之间插入s节点*/
s->next = p->next;
s->prior = p;
p->next->prior = s;
p->next = s;
双向链表的删除
/*删除节点p*/
p->prior->next = p->next;
p->next->prior = p->prior;
free(p);
上一篇: 1.1封装数组