欢迎来到天天文库
浏览记录
ID:45482695
大小:351.00 KB
页数:10页
时间:2019-11-13
《《树作业参考答案》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.Slidesfor
2、.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假设一棵二叉树,其后根顺序的结点排序为:DCEGBFHKJIA,而按中根顺序的结点排列为
3、: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;elsereturnBitreeLeafCount(T-->lchild)+Bitr
4、eeLeafCount(T-->rchild);}Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.5画出和下列树对应的二叉树:Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.6将下列森林转换为对应的二叉树:Evaluationonly.Createdwit
5、hAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.7Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.8画出和下列二叉树相应的森林:Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011A
6、sposePtyLtd.9Evaluationonly.CreatedwithAspose.Slidesfor.NET3.5ClientProfile5.2.0.0.Copyright2004-2011AsposePtyLtd.10
此文档下载收益归作者所有