欢迎来到天天文库
浏览记录
ID:52091568
大小:351.00 KB
页数:10页
时间:2020-03-31
《《树作业参考答案》PPT课件.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、第六章树作业参考答案Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.1作业1.1已知一棵含有n个结点的树中,只有度为k的分支结点和度为0的叶子结点。试求该树含有的叶子结点的数目。解:由题意可知n=nk+n0(1)又因为分支B=n-1(2)同时分支B=k*nk(3)由(1)、(2)、(3)得到n-1=k*(n-n0)所以n0=Evaluationonly.CreatedwithAspose
2、.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.2作业2.1假设一棵二叉树,其先根顺序的结点排序为:EBADCFHGIKJ,而按中根顺序的结点排列为:ABCDEFGHIJK。试画出这棵二叉树。Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.3作业2.2假设一棵二叉树,其后根顺序的结点排序为:DCEG
3、BFHKJIA,而按中根顺序的结点排列为:DCBGEAHFIJK。试画出这棵二叉树。Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.4作业2.3统计二叉树中叶子结点个数算法。intBitreeLeafCount(BiTreeT){if(T==NULL)return0;elseif(T-->lchild==NULL&&T->rchild==NULL)return1;elsereturnBi
4、treeLeafCount(T-->lchild)+BitreeLeafCount(T-->rchild);}Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.5画出和下列树对应的二叉树:Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.6
5、将下列森林转换为对应的二叉树:Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.7Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.8画出和下列二叉树相应的森林:Evaluationonly.CreatedwithAspose.Slides
6、for.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.9Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.10
此文档下载收益归作者所有