题目内容

阅读下列程序说明和C程序,将应填入(n)处的字句写在对应栏内。
[说明]
本程序将自然数1,2,……,N2(N=5)按蛇形方式逐个顺序存入N阶矩阵。令n=N-1,则矩阵中的每一元素可用aij标记,其中i,j(0≤i,j≤n)分别为其所在行的行号和所在列的列号。蛇形方式顺序存放的方法是从an0开始、到a0n为止,依次填入由1递增的自然数,交替地对每一斜列从左上角向右下角或从右下角向左上角排列。程序的输出为:
[程序]
include <stdio.h>
include <math.h>
define SIZE.10
int a[SIZE] [SIZE],k;
void write(int n) /*输出矩阵*/
{ int i,j;
for(i=0;i<=n;i+ +){
for(j=0; j<=nj j+ +)
printf("%4d",a[i][j]);
printf("\n");
}
}
void makeline(int row_start, int col_start, int row_end) /*完成矩阵一条斜线的整数填写*/
{ int i,j, sign;
sign=((1)> =0)? 1:-1;
for(i = row_start,j = col_start; (row_end-i) * sign>=0; i+=sign,j+=sign)
a[i][j]=(2);
}
void makeArray(int n) /*完成矩阵每条斜线的整数填写*/
{ int d;
for(d=1;d<=(3);d+ +)
if(d< =n+1)
if(d%2)
makeline((4));
else
makeline(n+1-d,0,n);
else
if(d%2)
makeline((5));
else
makeline(0,d-n-1,2*n-d+1);
}
void main()
{ int n, N=5;
k=1; n=N-1;
makeArray(n);
write(n);
}

查看答案
更多问题

阅读下列函数说明和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;

在传统集合运算中,假定有关系R和S,运算结果为RS。
如果RS中的元组属于R而不属于S,则RS是【 】运算的结果。

依据ISO/OSI参考模型对无线扩频网络设备进行分类,可以分为哪几种类型?用无线扩频设备实现网络互连需要何种配套设备?

辨析题
第58小题,8分。要求对命题进行判断并着重阐明理由。请将答案写在答题纸指定位置上。
王某有3个子女,都已经结婚并独立生活,王某与妻子生活在一起。在王某于2001年7月10日去世时,其家庭财产包括房屋8间,存款8000元。王某的大儿子说:“父亲的遗产一共是8间房屋与8000元钱,应当由我们三子女和母亲继承,各得2间房和2000元钱。”王某大儿子的主张能否成立?试运用民法原理并结合我国有关法律规定加以分析。

答案查题题库