在一个单链表中,已知q所指结点是p所指结点的前驱结点,若在q和p之间插入一个结点s,则执行()。

A:s->next=p->next;p->next=s; B:p->next=s->next;s->next=p; C:q->next=s;s->next=p; D:p->next=s;s->next=q;

在双向循环链表中,在P所指的结点之后插入S指针所指的结点,其操作是( )。

A:p—>next=s;s—>prior=p;p—>next—>prior=s;s—>next=p—>next; B:s—>prior=p;s—>next=p—>next;p—>next=s;P—>next—>prior=s: C:p—>next=s;p—>next—>prior=s;s—>prior=p;s—>next=p—>next; D:s—>prior=p;s—>next=p—>next;p—>next—>prior=s;p—>next=s:

(48)~(50)以下程序的功能足:建立一个带有头结点的甲—向链表,并将存储在数组中的字符依次转存到链表的各个结点中,请从与下划线处号码对应的一组选项中选择出正确的选项。
#include <stdlib.h>
struct node
char data; struct node *next: ;
(48) CreatList(char *s)

struct node *h,*p,*q;
h = (struct node *)malloc sizeof(struct node));
p=q=h;
while(*s! =’/0’)

p = (struct node *)malloc(sizeof (struct node));
p->data = (49) ;
q->next = p;
q - (50) ;
S++;

p->next=’/0’;
return h;

main( )

char str[]="link list";
struct node *head;
head = CreatList(str);

A:p->next B:p C:s D:s >next

若已建立如下图所示的单向链表结构: 在该链表结构中,指针p、s分别指向图中所示结点,则不能将s所指的结点插入到链表末尾仍构成单向链表的语句组是______。

A:p=p->next;s->next=p;p->next=s; B:p=p->next;s->next=p->next;p->next=s; C:s->next=NULL;p=p->next;p->next=S; D:p=(*p).next;(*S).next=(*p).next;(*p).next=s;

以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下画线处号码对应的一组选项中选择正确的选项。
#include <stdio.h>
struct node
char data; struct node *next; ;
(48) CreatList(char *s)
struct node *h, *p, *q;
h=(struct node *)malloc(sizeof(struct node));
p=q=h;
while (*s!=’/0’ )
p=(struct node *)malloc(sizeof(struct node));
p->data= (49) ;
q->next=p;
q= (50) ;
s++;

p->next=’/0’;
return h ;

main( )
char str[]="link list";
struet node *head ;
head=CreatList(str) ;


A:p->next B:p C:s D:s->next

若已建立如下图所示的单向链表结构: 在该链表结构中,指针p、s分别指向图中所示结点,则不能将s所指的结点插入到链表末尾仍构成单向链表的语句组是______。

A:p=p->next; s->next=p; p->next=s; B:p=p->next; s->next=p->next; p->next=s; C:s->next=NULL; p=p->next; p->next=s; D:p=(*.next; (*.next=(*.next; (*.next=s;

在循环双链表的p结点之后插入s结点的操作是______。

A:p→next=s; p→next→prior=s; S→prior=p; S→next=p→next; B:s→next=p; s→next=p→next; p→next=s; p→next→prior=s; C:p→next=s; s→prior=p; p→next→prior=s; s→next=p→next; D:s→prior=p; s→next=p→next; p→next→prior=s; p→next=S;

在循环双链表的p节点之后插入s节点的操作是______。

A:p→next=s; p→next→prior=s; s→prior=p; S→next=p→next; B:s→next=p; s→next=p→next; p→next=S; p→next→prior=s; C:p→next=s; s→prior=p; p→next→prior=s; s→next=p→next; D:s→prior=p; s→next=p→next; p→next→prior=s; p→next=s;

若已建立如下图所示的单向链表结构:   在该链表结构中,指针p、s分别指向图中所示结点,则不能将s所指的结点插入到链表末尾仍构成单向链表的语句组是()。

A:p=p->next;s->next=p;p->next=s; B:p=p->next;s->next=p->next;p->next=s; C:s->next=NULL;p=p->next;p->next=S; D:p=(*.next;(*.next=(*.next;(*.next=s;

以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下划线处号码对应的一组选若中选择出正确的选项。#include
stuct node{ char data; struct node *next;}; (1) CreatLis(char *s){
struct node *h,*p,*q); h=(struct node *)malloc(sizeof(struct node));
p=q=h; while(*s!=’/0’) { p=(struct node
*)malloc(sizeof(struct node)); p->data= (2) ;
q->next=p; q= (3) ; s++; }
p->next=’/0’; return h;}main( ){ char str[]="link list";
struct node *head; head=CreatLis(str); ...}

3()

A:p->next B:p C:s D:s->next

微信扫码获取答案解析
下载APP查看答案解析