考研

导航
  • 返回首页
  • 国家公务员
  • 地方公务员
  • 事业单位
  • 遴选考试
  • 政法干警
  • 大学生村官
  • 军转干
  • 教师考试
  • 招警
  • 选调生
  • 三支一扶
  • 农村信用社
  • 银行考试
  • 医学考试
  • 会计考试
  • 在职硕士
  • 医疗卫生招聘
  • 社区工作者
  • 考研
  • 公益性岗位
  • 国企招聘
  • 乡镇公务员
var WHITELIST_CUSTOM = [{ name: 'document', /** document 允许使用以下属性或方法*/ properties: ['getElementsByClassName'] }] MIP.watch('i', function (newVal) { var ele2 = MIP.sandbox.document.getElementsByClassName('zg_ksfllb'); var eles = MIP.sandbox.document.getElementsByClassName('zg_lxli'); for(var i=0;i< ele2.length;i++){ if(newVal==i){ ele2[i].style.display = "block"; }else{ ele2[i].style.display = "none"; } } for(var i=0;i< eles.length;i++){ if(newVal==i){ eles[i].classList.add("zg_act1"); }else{ eles[i].classList.remove("zg_act1"); } } })
您现在的位置: 查字典公务员网 >考研 >考试题库 >考研专业课 >计算机数据结构测试题(三)答案

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

2015-01-28 01:01:30
查字典公务员网

一、选择题

1.C 2.C 3.C 4.B 5.B

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

二、判断题

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

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

三、填空题

1. 1. (49,13,27,50,76,38,65,97)

2. 2. t=(bitree *)malloc(sizeof(bitree)),bstinsert(t-rchild,k)

3. 3. p-next=s

4. 4. head-rlink,p-llink

5. 5. CABD

6. 6. 1,16

7. 7. 0

8. 8. (13,27,38,50,76,49,65,97)

9. 9. n-1

10. 10. 50

四、算法设计题

1. 1. 设计一个在链式存储结构上统计二叉树中结点个数的算法。

void countnode(bitree *bt,int count)

{

if(bt!=0)

{count++; countnode(bt-lchild,count); countnode(bt-rchild,count);}

}

2. 2. 设计一个算法将无向图的邻接矩阵转为对应邻接表的算法。

typedef struct {int vertex[m]; int edge[m][m];}gadjmatrix;

typedef struct node1{int info;int adjvertex; struct node1 *nextarc;}glinklistnode;

typedef struct node2{int vertexinfo;glinklistnode *firstarc;}glinkheadnode;

void adjmatrixtoadjlist(gadjmatrix g1[ ],glinkheadnode g2[ ])

{

int i,j; glinklistnode *p;

for(i=0;ii++) g2[i].firstarc=0;

for(i=0;ii++) for(j=0;jj++)

if (g1.edge[i][j]==1)

{

p=(glinklistnode *)malloc(sizeof(glinklistnode));p-adjvertex=j;

p-nextarc=g[i].firstarc; g[i].firstarc=p;

p=(glinklistnode *)malloc(sizeof(glinklistnode));p-adjvertex=i;

p-nextarc=g[j].firstarc; g[j].firstarc=p;

}

}

点击显示

 推荐文章

 猜你喜欢

 附近的人在看

 推荐阅读

 拓展阅读

 最新资讯

 热门

 相关资讯

  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  •