假定建立了以下链表结构,指针p、q分别指向如图所示的结点,则以下可以将q所指结点从链表中删除并释放该结点的语句组是 ( )
A.free(q);p->Next=q->next;
B.(* p).next=(* q).nexy;free(q);
C.q=(* q).next;(* p).next=q;free(q);
D.q=q->next;p->next=q;p=p->next;free(p);
第1题:
在一个单链表中,p、q分别指向表中两个相邻的结点,且q所指结点是p所指结点的直接后继,现要删除q所指结点,可用的语句是()。
A.p=q->next
B.p->next=q
C. p->next=q->next
D.q->next=NULL
第2题:
A、q=p
B、q->next=p
C、p=q->next
D、p->next=q
第3题:
A、p->next=q;q->prior=p;p->next->prior=q;q->next=q;
B、q->prior=p;q->next=p->next;p->next->prior=q;p->next=q;
C、q->next=p->next;q->prior=p;p->next=q;p->next=q;
D、p->next=q;p->next->prior=q;q->prior=p;q->next=p->next;
第4题:
有以下结构体说明和变量定义,如图所示,指针p、q、r分别指向一个链表中的三个连续结点。
struct node
{ int data;
struct node *next;
} *p, *q, *r;
现要将q和r所指结点的先后位置交换,同时要保持链表的连续,以下错误的程序段是
A.r->next=q; q->next=r->next; p->next=r;
B.q->next=r->next; p->next=r; r->next=q;
C.p->next=r; q->next=r->next; r->next=q;
D.q->next=r->next; r->next=q; p->next=r;
第5题:
此题为判断题(对,错)。
第6题:
A.p->next=q;q->prior=p;p->next->prior=q;q->next=q;
B.p->next=q;p->next->prior=q;q->prior=p;q->next=p->next;
C.q->prior=p;q->next=p->next;p->next->prior=q;p->next=q;
D.q->prior=p;q->next=p->next;p->next=q;p->next->prior=q;
第7题:
A、p->next=q->next
B、q->next=NULL
C、p->next=q
D、p=q->next
第8题:
程序中已构成如下图所示的不带头结点的单向链表结构,指针变量s、p、q均已正确定义,并用于指向链表结点,指针变量s总是作为头指针向链表的第—个结点。
若有以下程序段 q=s; s=s->next; p=s; while(p->next) p=p->next; P->next=q; q->next=NULL; 该程序段实现的功能是______。
A.首结点成为尾结点
B.尾结点成为首结点
C.删除首结点
D.删除尾结点
第9题:
A、q->next=x->next;x->next=p;
B、s->next=p;q->next=x->next;
C、p->next=x->next;x->next=p;
D、x->next=q;p->next=x->next;
第10题:
假定已建立以下链表结构,且指针p和q已指向如图所示的结点:
则以下选项中司将q所指结点从链表中删除并释放该结点的语句组是______。
A.(*p).next=(*q).next; free(p);
B.p=q->next; free(q);
C.p=q; free(q);
D.p->next=q->next; free(q);