问答题
( )是指服从于特定统计分布的随机生成的数值。
点击查看答案
相关考题
未知题型
阅读下列程序说明和C代码,将应填入(n)处的字句写在对应栏内。
[函数2.1说明]
函数void find(int *a, int n, int * max, int * min)的功能是在长度为n的整型数组a中,查找最大元素和最小元素的下标。main()中给出了调用find函数的一个实例。
[函数2.1]
include<stdio.h>
void find(int *a, int n,int *max,int * min)
{ int i;
*max =* min=0;
for(i=1;i<n;i+ +)
if(a[i]>a[* max]) (1);
else if(a[i]<a[*min]) (2);
return;
main()
{ int a[]={4,6,8,9,0,6},max,min;
find(a,6,(3));
printf('%5d%5d/n', max,min);
}
[函数2.2说明]
以下程序用来对从键盘上输入的两个字符串进行比较,然后输出两个字符串前端的公共部分。例如:输入的两个字符串分别是abcdefg和abceef,则输出为abc。
[函数2.2]
include <stdio.h>
main()
{ char str1[100],str2[100],str[100],c;
int i=0,s;
printf('/nInput string 1:');gets(str1);
printf('/nInput string 2:');gets(str2);
while(((4))&&(str1[i]!='/0')&&(str2[i]!='/0')){
(5);
i++;
}
printf('%s/n',str);
}
未知题型
阅读下列函数说明和C函数,将应填入(n)处的字句写在对应栏内。
[说明]
二叉树的二叉链表存储结构描述如下:
lypedef struct BiTNode
{ datatype data;
street BiTNode *lchiht, *rchild; /*左右孩子指针*/ } BiTNode, *BiTree;
下列函数基于上述存储结构,实现了二叉树的几项基本操作:
(1) BiTree Creale(elemtype x, BiTree lbt, BiTree rbt):建立并返回生成一棵以x为根结点的数据域值,以lbt和rbt为左右子树的二叉树;
(2) BiTree InsertL(BiTree bt, elemtype x, BiTree parent):在二叉树bt中结点parent的左子树插入结点数据元素x;
(3) BiTree DeleteL(BiTree bt, BiTree parent):在二叉树bt中删除结点parent的左子树,删除成功时返回根结点指针,否则返回空指针;
(4) frceAll(BiTree p):释放二叉树全体结点空间。
[函数]
BiTree Create(elemtype x, BiTree lbt, BiTree rbt) { BiTree p;
if ((p = (BiTNode *)malloc(sizeof(BiTNode)))= =NULL) return NULL;
p->data=x;
p->lchild=lbt;
p->rchild=rbt;
(1);
}
BiTree InsertL(BiTree bt, elemtype x,BiTree parent)
{ BiTree p;
if (parent= =NULL) return NULL;
if ((p=(BiTNode *)malloc(sizeof(BiTNode)))= =NULL) return NULL;
p->data=x;
p->lchild= (2);
p->rchild= (2);
if(parent->lchild= =NULL) (3);
else{
p->lchild=(4);
parent->lchild=p;
}
return bt;
}
BiTree DeleteL(BiTree bt, BiTree parent)
{ BiTree p;
if (parent= =NULL||parent->lchild= =NULL) return NULL;
p= parent->lchild;
parent->lchild=NULL;
freeAll((5));
return bt;
微信扫一扫,加关注免费搜题