问题 单项选择题

双链表的每个节点包括两个指针域。其中rlink指向节点的后继,llink指向节点的前驱。如果要在p所指节点后插入q所指的新节点,下面哪一个操作序列是正确的

A.p↑.rlink↑.llink: =q; p↑.rlink: =q; q↑.llink: =p; q↑.rlink: =p↑.rlink;

B.p↑.llink↑.rlink: =q; p↑.llink: =q; q↑.rlink: =p; q↑.llink: =p↑.llink;

C.q↑.llink: =p; q↑.rlink: =p↑.rlink; p↑.rlink↑.llink: =q; p↑.rlink: =q↑;

D.q↑.rlink: =p; q↑.llink: =p↑.llink; p↑.llink↑.rlink: =q; p↑.llink: =q;

答案

参考答案:C

解析: 在双链表中,如果要在P所指节点后插入q所指的新节点,只需修改P所指节点的rlink字段和原后继的llink字段,并置q所指节点的llink和rlink值。即:q↑.llink:=p;q↑.rlink:=p↑.rlink;p↑.rlink↑.rlink:=q;p↑.rlink:=q。

填空题
多项选择题