题目内容

According to the 1st paragraph, experts have interests in ____________.

查看答案
更多问题

已有文本文件test.txt,其中的内容为:I am the winner!。以下程序中,文件test.txt已正确为“读”而打开,由文件指针fr指向该文件,则程序的输出结果是______。 main() { FILE*fr;char str[40]; … fgets(str,5,fr); printf("%s\n",str); fclose(fr); }

The Japanese team thinks that research techniques similar to their own could be used to bring about more _______________________.

[说明] 假设设A和B均为顺序表,A’和B’分别为A和B中除去最大共同前缀后的子表(例如,A=(x,y,y,z,x,z),B=(x,y,y,z,y,x,x,z),则两者中最大的共同前缀为(x,y,y,z),在两表中除去最大共同前缀后的子表分别为A’=(x,z)和B’=(y,x,x,z)。若A’=B’=空表,则A=B;若A’=空表,而 B’!=空表,或者两者均不为空表,且A’的首先小于B’的首元,则A<B;否则A>B。 下面程序实现了比较A、B大小的算法。 [C程序] #include<stdio.h> #include<stdlib.h> typedef struct linknode { int data; struct linknode *next; }node: node *creatlist ( ) /*建立单链表*/{ node*head, *r, *s; int x; head= (node *) malloc (sizeof (node)); /建立单链表的头结点head*/ r=head; printf ("输入系列整数,以O标志结束\n"); scanf ("%d", &x); while (x!=O) /*x==O则退出while循环*/ { s=(node*) malloc (sizeof (node)); s->data=x; r->next=s; s->next=NULL; r=s; scanf ("%d", &x); } r->next=NULL; s=head; (1) ; Free (s); return head;}void subs ( ){ node*p, *p1, *p2, *q, *heada, *headb; heada=creatlist ( ) ; headb=creatlist ( ) ; p=heada; p1=p; /*p1指向p所指结点的前一个结点,开始时均缀向头结点*/ while (p!=NULL ) { q=headb; while (q!=NULL&&q->data!=p->data) q=q->next; if ( (2) ) { if (p==heada) { (3) ; p1=heada; } else if (p->next==NULL) p1->next=NULL; /*该结点为最后一结点,删除*/ else p1->next=p->next; p2=p->next; (4) ; free (p); (5) ; } else /*p所指结点的元素不在B中,则直接下移p*/ { p1=p; (6) ; }}p=heada; /*显示删除后的结果*/if (p==NULL) printf ("两集合机减的结果为空\n");else printf ("两集合相减的结果\n");while (p!=NULL){ printf ("%d", p->data); p=p->next;}}void main ( ){ subs ( ) ;}

1】 假设以带头结点的单循环链表作非递减有序线性表的存储结构。函数deleteklist(LinkList head)的功能是删除表中所有数值相同的多余元素,并释放结点空间。 例如:链表初始元素为: (7, 10,10,21,30,42,42,42,51,70) 经算法操作后变为: (7,10,21,30,42,51,70) 【函数3.1】 void deleteklist(LinkList head) LinkNode * p, * q; p=head->next; while(p!=head) q=p->next; while( (1) ) (2) ; free(q); q=p->next; p=p->next; 【说明3.2】 已知一棵完全二叉树存放于一个一维数组T[n]中,T[n]中存放的是各结点的值。下面的程序的功能是:从T[0]开始顺序读出各结点的值,建立该二叉树的二叉链表表示。 【函数3.2】 #include<istream.h> typedef struct node int data; stuct node leftChild, rightchild; BintreeNode; typedef BintreeNode * BinaryTree; void ConstrncTree(int T[], int n, int i, BintreeNode * &ptr) if(i>=n) (3) ; /*置根指针为空*/ else ptr=-(BTNode * )malloc(sizeof(BTNode) ) ptr->data=T[i]; ConstrucTree(T,n,2, i+1, (4) ); ConstrucTree(T,n, (5) ,ptr->rightchild); main(void) /*根据顺序存储结构建立二叉链表*/ Binarytree bitree;int n; printf("please enter the number of node: \n%s" ;n); int* A = (int *) malloc(n * sizeof(int)); for(int i=0;i<n;i++)scanf(" %d,A+i); /*从键盘输入结点值*/ for(int i=0;i<n;i++)printf(" %d",A[i]); ConstructTree(A, n,0, bitree);

答案查题题库