早教吧 育儿知识 作业答案 考试题库 百科 知识分享
早教吧考试题库频道 --> 计算机类考试 -->软考中级 -->

某双向链表中的结点如下图所示,删除t所指结点的操作为(54)。A.t->prior->next=t->next;t->next->p

题目

某双向链表中的结点如下图所示,删除t所指结点的操作为(54)。

A.t->prior->next=t->next;t->next->prior=t->prior;

B.t->prior->prior=t->prior;t->next->next=t->next;

C.t->prior->next=t->prior;t->next->prior=t->next;

D.t->prior->prior=t->next;t->next->prior=t->prior;

参考答案
正确答案:A
解析:本题考查链表的基本运算。设q指向t的前驱结点,P指向t的后继结点,如下所示。
  可知,q=t->prior,p=t->next。
  删除t所指结点的操作为:
  ①q->next=p;
  ②p->prior=q。
  由于题目中没有给出指针p和q,所以将①、②中的p和q分别代换为“t->next”和“t->prior”,则得到
  t->prior->next=t->next
  t->next->prior=t->prior