考研

您现在的位置: 查字典公务员网 >考研 >考试题库 >考研专业课 >计算机数据结构测试题(二)答案

计算机数据结构测试题(二)答案

2015-01-27 07:01:49
查字典公务员网

一、选择题

1.A 2.A 3.A 4.C 5.D

6.D 7.C 8.B 9.C 10.A

11.C 12.C 13.D 14.A 15.A

二、填空题

1. 1. p-next,s-data

2. 2. 50

3. 3. m-1

4. 4. 6,8

5. 5. 快速,堆

6. 6. 19/7

7. 7. CBDA

8. 8. 6

9. 9. (24,65,33,80,70,56,48)

10. 10. 8

三、判断题

1.错 2.对 3.对 4.对 5.错

6.错 7.对 8.对 9.错 10.对

四、算法设计题

1. 1. 设计计算二叉树中所有结点值之和的算法。

void sum(bitree *bt,ints)

{

if(bt!=0) {s=s+bt- sum(bt-lchild,s); sum(bt-rchild,s);}

}

2. 2. 设计将所有奇数移到所有偶数之前的算法。

voidquickpass(int r[], int s, int t)

{

inti=s,j=t,x=r[s];

while(i

{

while (i

}

r[i]=x;

}

3. 3. 设计判断单链表中元素是否是递增的算法。

intisriselk(lklist *head)

{

if(head==0||head-next==0) return(1);else

for(q=head,p=head- p!=0; q=p,p=p-next)if(q-p-data) return(0);

return(1);

}

查看全部

 推荐文章

 猜你喜欢

 附近的人在看

 推荐阅读

 拓展阅读

 最新资讯

 热门

 相关资讯

 猜你喜欢

返回顶部