K12教育赛事综合服务平台
聚乐之家官方网站
下载聚乐之家官方App
专注青少年竞赛题库网站
已知双向链表的每个结点包含三个域:存储数据的data域、指向直接前驱的prior指针域、指向直接后继的next指针域。现有指针p指向链表中某个非空结点,指针s指向待插入的新结点。
s->prior = p; s->next = p->next; if(p->next != NULL) p->next->prior = s; p->next = s;
p->next = s; s->prior = p; s->next = p->next; if(p->next != NULL) p->next->prior = s;
s->prior = p->next; s->next = p; if(p->next != NULL) p->next->prior = s; p->next = s;
s->prior = p; s->next = p->next; p->next = s;