填空题完成下列折半插入排序算法。 Void binasort(struct node r[MAXSIZE],int n) {for(i=2;i else low=mid+1 ; } for(j=i-1;j=low;j- -)r[j+1]=r[j] ; r[low]=() ; } }
填空题
完成下列折半插入排序算法。 Void binasort(struct node r[MAXSIZE],int n) {for(i=2;i else low=mid+1 ; } for(j=i-1;j>=low;j- -)r[j+1]=r[j] ; r[low]=() ; } }
参考解析
解析:
暂无解析
相关考题:
下列程序的运行结果为【14】#include stdio.h#include string.hstruct A{int a;char b[10];double c;};void f (struct A *t);main(){struct A a=(1001,”ZhangDa”,1098,0);f(a);printf(“d,s,6,if\n”,a.a,a.b,a.c);}void f(struct A *t){strcpy(t-b,”ChangRong”); }
下列程序的运行结果为【 1 4 】#include stdio.h#include string.hstruct A{int a; char b[10];double c;};void f(struct A *t);main(){ struct A a={1001,"ZhangDa",1098.0};f(a); printf("%d,%s,%6.1f\n",a.a,a.b,a.c);}void f(struct A *t){ strcpy(t-b,"ChangRong");}
有以下程序#includestruct NODE{ int num; struct NODE *next; };main(){ struct NODE *p,*q,*r;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE));r=(struct NODE*)malloc(sizeof(struct NODE));p-num=10; q-num=20; r-num=30;p-next=q;q-next=r;printf("%d\n ",p-num+q-next-num);}程序运行后的输出结果是A.10B.20C.30D.40
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。[说明]下面程序实现十进制向其它进制的转换。[C++程序]include"ioStream.h"include"math.h"includetypedef struct node {int data;node*next;}Node;Class Transform.{DUDlic:void Trans(int d,int i); //d为数字;i为进制void print();private:Node*top;};void Transform.:Trans(int d,int i){int m,n=0;Node*P;while(d>0){(1);d=d/i;p=new Node;if(!n){p->data=m;(2);(3);n++;}else{p->data=m;(4);(5);}}}void Transform.:print(){Node*P;while(top!=NULL){p=top;if(p->data>9)cout<<data+55;elsecout<<data;top=p->next;delete p;}}
有以下程序: inClude structNODE{ int num; structNODE*next; }; main() {StructN00E 有以下程序:#inClude <stdlib.h>struct NODE{int num;struct NODE *next;};main(){ Struct N00E *p,*q,*r;int sum;0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struct NODE));r=(struct NODE *)malloc(Sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;printf("%d\n",sum);}执行后的输出结果是A.3B.4C.5D.6
下列程序的运行结果为【】。 include include {int a; char b[10]; double c;}; 下列程序的运行结果为【 】。include<stdio.h>include<string.h>{ int a; char b[10]; double c; };void f (struct A *t);main(){ struct A a={1001,"ZhangDa",1098.0};f(a) ; printf("%d,%s,%6.lf\n",a.a,a.b,a.C);}void f(struct A*t){ strcpy(t->b, "ChangRong");}
有以下程序: include include struct NODE {int num;struct NODE *next; } 有以下程序:#include <stdio.h>#include <stdlib.h>struct NODE{ int num;struct NODE *next;};main(){ struet NODE *p,*q,*r;int sum=0;p=(struct NODE *) malloc(sizeof(struct NODE));q=(struct NODE *) malloc(sizeof(struet NODE));r=(struct NODE *) malloc(sizeof(struct NODE));P- >num=1;q- >num=2;r->num=3;p- >next=q;q- >next=r;r- >next=NULL;sum + =q- >next- >num;sum + =P- >num;printf("%d\n",sum);}执行后的输出结果是( )A.3B.4C.5D.6
以下程序运行后的输出结果是【 】。struct NODE{int num;struct NODE *next;};main(){struct NODE s[3]={{1,'\0'},{2,'\0'},{3,'0'}},*p,*q,*r;int sum=0;s[0].next=s+1;s[1].next=s+2;s[2].next=s;p=s; q=p->next; r=q->next;sum+=q->next->num; sum+=r->next->next->num;printf("%d\n",sum);}
有以下程序includevoid f(int *p,int *q);main(){ int m=1,n=2,*r=m;f(r, n 有以下程序 #include<stdio.h> void f(int *p,int *q); main() { int m=1,n=2,*r=m; f(r, n); printf("%d,%d",m,n); } void f(int*p,int*q) {p=p+1; *q=*q+1;) 程序运行后的输出结果是______。A.1,3B.2,3C.1,4D.1,2
有以下程序 include struct NODE {int num;stmct NODE*next;}; main() { struct NODE 有以下程序#include<stdlib.h>struct NODE{ int num;stmct NODE*next;};main(){ struct NODE*p,*q,*r;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE));r=(struct NODE*)malloc(sizeof(struct NODE));p->num=10;q->num=20;r->num=30;p->next=q;q->next=r;printf(“%d\n”,p->num+q->next->num);}程序运行后的输出结果是A.10B.20C.30D.40
有以下程序: include struct NODE{ int num; struct NODE*next; } main() {structNOD 有以下程序:#include<stdlib.h>struct NODE{int num;struct NODE *next;}main(){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(Struct NODE *)malloc(sizeof(struct NODE));r=(Struct NODE *)malloc(sizeof(struct NODE));p->num=1; q->num=2; r->num=3;p->next=q; q->next=r; r->next=NULL;sum+=q->next->num;sum+=p->num;printf("%d\n",sum);}执行后的输出结果是( )。A.3B.4C.5D.6
有以下程序 include struct NODE{ int num; struct NODE *next;}; main( ) 有以下程序#include <stdlib.h>struct NODE{int num;struct NODE *next;};main( ){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struct NODE));r=(struct NODE *)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;printf(“%d\n”,sum);}执行后的输出结果是A.3B.4C.5D.6
C 程序写运行结果。class A{public:void f1(){printf("A::f1\r\n");}virtual void f2(){printf("A::f2\r\n");}void callfunc(){printf("A::callfunc\r\n");f1();f2();}};class B :public A{public:void f1(){printf("B::f1\r\n");}void f2(){printf("B::f2\r\n");}void callfunc(){printf("B::callfunc\r\n");f1();f2();}};int main(){B *pB=new B;pB-callfunc();A *pA=pB;pA-callfunc();return 0;}
下而程序实现十进制向其他进制的转换。[C++程序]include"ioStream.h"include"math.h"include <conio.h>typedef struct node{int data;node *next;}Node;class Transform{public:void Trans(int d,int i); //d为数字;i为进制void print();private:Node *top;};void Transform.:Trans(int d,int i){int m,n=0;Node *P;while(d>0){(1) ;d=d/i;p=new Node;if(!n){P->data=m;(2) j(3) ;n++;}else{p->data=m;(4) ;(5) ;}}}void Transform.:print(){Node *P;while(top!=NULL){p=top;if(P->data>9)cout<<data+55:elsecout<<data;top=p->next;delete P;}}
有以下程序: include struct NODE { int num; struct NODE*next; }; main() { struct 有以下程序:#include <stdlib.h>struct NODE{ int num; struct NODE *next; };main(){ struct NODE *p,*q,*r;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)mallloc(sizeof(struct NODE));r=(struct NODE*)malloc(sizeof(struct NODE));p->num=10;q->num=20; r->num=30;p->next=q;q->next=r;printf("%d\n",p->num+q->next->num);}程序运行后的输出结果是( )。A.10B.20C.30D.40
有以下程序:struct S{int n;int a[20];};void f(struct S*P){int i,j,t;for(i=0;in-1;i++)fo 有以下程序: struct S{int n;int a[20];}; void f(struct S*P) { int i,j,t; for(i=0;i<P->n-1;i++) for(j=j+1;j<P->n-1;j++) if(p->a[i]>p->a[j]) {t=P->a[i];p->a[i]=P->a[j];p->a[j]=t} } main() {int i;struct S s{10,{2,3,1,6,8,7,5,4,10,9}}; f(&s); for(i=0;i<s.n;i++)printf("%d",s.a[i]);} 程序运行后的输出结果是( )。A.3B.4C.5D.6
有以下程序 include gtruet NODE {intnum;struct NODE *next;}; main() {struct NODE 有以下程序#include <stdlib.h>gtruet NODE{ int num; struct NODE *next; };main(){struct NODE *p,*q,*r;p=(struct NODE*)malloc(sizeof (struct NODE));q=(struct NODE*)malloc(sizeof (struct NODE));r=(struct NODE*)malloc(sizeef (struct NODE));p->num=10; q->num=20; r->num=30;p->next=q; q->next-r;printf("%d\n",p->num+q->next->num);}程序运行后的输出结果是A.10B.20C.30D.50
有以下程序: include struct NODE {int num;stmct NODE *next;}; main( ) { str 有以下程序:#include<stdlib.h>struct NODE{ int num;stmct NODE *next;};main( ){ struct NODE * p, * q,* r;p=(struct NODE * )malloc(sizeof(struct NODE) );q=(struct NODE * )malloc(sizeof(struct NODE) );r=(struct NODE * )malloc(sizeof(struct NODE) );p->num=10; q->num=20; r->num=30;p->next=q; q->next=r;printf("%d\n",p->num+q->next->num);}程序运行后的输出结果是A.10B.20C.30D.40
有以下程序 include struct NODE {int num;struct NODE*next;} main() {struct NODE 有以下程序#include<stdlib.h>struct NODE{int num;struct NODE*next;}main(){struct NODE *P,*q,*r;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struet NODE));r=(struct NODE*)malloc(sizeof(struct NODE)):p->num=10;q->num=20;r->num=30;p->next=q;q->next=r;printf("%d\n",p->num+q->next->num):}程序运行后的输出结果是( )A.10B.20C.30D.40
有以下程序 inGlude struct NODE { int num; struct NODE *next; } main() {struct N 有以下程序#inGlude<stdlib.h>struct NODE {int num;struct NODE *next;}main(){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE));r=(stnlct NODE*)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next;r;r->next=NULL;sum+=q->next->Num,sum+=p->num;printf("%d\n",sum);}执行后输出结果是A.3B.4C.5D.6
有以下程序: include struct NODE{int nurn;struct NODE *next; }; main() { struct 有以下程序:#include <stdlib.h>struct NODE{int nurn;struct NODE *next;};main(){ struct NODE *p,*q,*r;int sum=0;P=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE));r=(struct NODE*)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;Printf("%d\n",sum);}执行后的输出结果是( )。A.3B.4C.5D.6
下面程序的功能是建立一个有 3 个 结 点的单向循环链表,然后求各个 结 点数值域 data 中数据的和。请填空。include stdio.hinclude stdlib.hstruct NODE{ int data;struct NODE *next;};main(){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE));r=(struct NODE*)malloc(sizeof(struct NODE));p-data=100; q-data=200; r-data=200;p- next =q; q- next =r; r- next =p;sum=p-data+p-next-data+r-next-next 【 19 】 ;printf("%d\n",sum);}
请写出下列递归算法的功能。 typedef struct node{ datatype data; struct node *link; } *LinkList; int ALGORISM(LinkList list) { if(list==NULL) return 0; else return 1+ALGORISM(list-link); }
完成下列折半插入排序算法。 Void binasort(struct node r[MAXSIZE],int n) {for(i=2;i=n;i++){ r[0]=r[i];low=1;high=i-1; while(low=high){ mid=(low+high)/2; if(r[0].key else low=mid+1 ; } for(j=i-1;j=low;j- -)r[j+1]=r[j] ; r[low]=() ; } }
填空题设顺序存储的线性表存储结构定义为: struct sequnce {ELEMTP elem[MAXSIZE]; int len; /*线性表长度域*/ } 将下列简单插入算法补充完整。 void insert(struct sequnce *p,int i,ELEMTP x) {v=*p; if(iv.len+1)printf(“Overflow“); else { for(j=v.len;();j- -)(); v.elem[i]= () ;v.len=(); } }
问答题请写出下列递归算法的功能。 typedef struct node{ datatype data; struct node *link; } *LinkList; int ALGORISM(LinkList list) { if(list==NULL) return 0; else return 1+ALGORISM(list-link); }
填空题设线性链表的存储结构如下: struct node {ELEMTP data; /*数据域*/ struct node *next; /*指针域*/ } 试完成下列建立单链表的算法。 creat() {char var; head=(struct node *)malloc(sizeof(struct node)); head-next= () ; while((var=getchar())!=‘/n’){ ptr=( struct node *)malloc(sizeof(struct node)); ptr-data= var ;ptr-next=head-next; head-next= ptr ; } }