10.可以用带表头附加结点的链表表示线性表,也可以用不带头结点的链表表示线性表,前者最主要的好处是()。
A.可以加快对表的遍历
B.使空表和非空表的处理统一
C.节省存储空间
D.可以提高存取表元素的速度
13.在一个单链表head中,若要在指针p所指结点后插入一个q指针所指结点,则执行()。
A.p->next=q->next; q->next=p;
B.q->next=p->next; p=q;
C.p->next=q->next; p->next=q;
D.q->next=p->next; p->next=q;
16.以下程序段的功能是:输入一行字符,按输入的逆序建立一个链表。
char c;
struct node{
char info;
struct node *link;
} *top, *p;
top = NULL;
while ( (c = getchar() ) != '\n'){
p = (struct node*) malloc(sizeof(struct node));
p->info = c;
_________ ;
top = p;
}
A.top->link = p
B.p->link = top
C.top = p->link
D.p = top->link
18.在一个单链表head中,若要删除指针p所指结点的后继结点,则执行()。
A.p=p->next;free(p);
B.p->next=p->next->next; free(p);
C.q= p->next q->next=p->next; free(q);
D.q=p->next; p->next=q->next; free(q);
19.以下结构类型可用来构造链表的是()。
A.struct aa{ int a;int * b;};
B.struct bb{ int a;bb * b;};
C.struct cc{ int * a;cc b;};
D.struct dd{ int * a;aa b;};
设单链表中结点的结构为
struct LinkNode{ //链表结点定义
E data; //数据
LinkNode * link; //结点后继指针
};
不带头结点的单链表first为空的判定条件是()。
A.first==NULL;
B.first->link== NULL;
C.first->link== first;
D.first! = NULL
26.若已建立下面的链表结构,指针 p、q 分别指向图中所示结点,则不能将 q 所指结点插入到链表末尾的语句是( )。
A.
q->next = NULL;
p = p->next;
p->next = q;
B.
p = p->next;
q->next = p->next;
p->next = q;
C.
p = p->next;
q->next = p;
p->next = q;
D
p = (*p).next;
(*q).next = (*p).next;
(*p).next = q;