考研

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

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

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

一、选择题

1.A 2.D 3.B 4.B 5.B 6.D

7.A 8.D 9.D 10.C 11.B 12.D

二、填空题

1. 1. 4,10

2. 2. O(nlog2n),O(n2)

3. 3. n

4. 4. 1,2

5. 5. n(m-1)+1

6. 6. q-next

7. 7. 线性结构,树型结构,图型结构

8. 8. O(n2), O(n+e)

9. 9. 8/3

10. 10. (38,13,27,10,65,76,97)

11. 11. (10,13,27,76,65,97,38)

12. 12. 124653

13. 13. struct node *rchild,bt=0,createbitree(bt-lchild)

14. 14. lklist,q=p

三、算法设计题

1. 1. 设计在链式存储结构上合并排序的算法。

voidmergelklist(lklist *ha,lklist *hb,lklist *hc)

{

lklist *s=hc=0;

while(ha!=0 hb!=0)

if(ha-datadata){if(s==0) hc=s=ha; else {s- s=ha;};ha=ha-}

else {if(s==0) hc=s=hb; else {s- s=hb;};hb=hb-}

if(ha==0) s- else s-

}

2. 2. 设计在二叉排序树上查找结点X的算法。

bitree *bstsearch1(bitree *t, int key)

{

bitree *p=t;

while(p!=0) if (p-key==key) return(p);else if (p-key)p=p- else p=p-

return(0);

}

3. 3. 设关键字序列(k1,k2,,kn-1)是堆,设计算法将关键字序列(k1,k2,,kn-1,x)调整为堆。

voidadjustheap(int r[ ],int n)

{

int j=n,i=j/2,temp=r[j-1];

while (i=1) if (temp=r[i-1])break; else{r[j-1]=r[i-1]; j=i; i=i/2;}

r[j-1]=temp;

}

查看全部

 推荐文章

 猜你喜欢

 附近的人在看

 推荐阅读

 拓展阅读

 最新资讯

 热门

 相关资讯

 猜你喜欢

返回顶部