双向链表中有两个指针域:prior和next 分别指回前驱及后继。设p指向链表中的一个结点 q指向待插入
已帮助 人
双向链表中有两个指针域:prior和next,分别指回前驱及后继。设p指向链表中的一个结点,q指向待插入结点,现要求在p前插入q,则正确的插入语句序列为()。
A.p->prior=q; q->next=p; p->prior->next=q; q->prior=p->prior;
B.q->prior=p->prior; p->prior->next=q; q->next=p; p->prior=q->next;
C.q->next=p; p->next=q; p->prior->next=q; q->next=p;
D.p->prior->next=q; q->next=p; q->prior=p->prior; p->prior=q;
E.q->prior=p->prior; q->next=p; q->prior->next=q;q->next->prior=q;

回答
共1条回复-
p-prior->next=q; q->next=p; q->prior=p->prior; p->prior=q;
