如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
会计学2005考研(kǎoyán)试题2005考研(kǎoyán)试题2005考研(kǎoyán)试题2006考研(kǎoyán)试题在二叉链表的每个结点中添加一个域intdepth,表示以该结点为根的子树的深度,即:typedefstructBiTNode{//结点结构TElemTypedata;structBiTNode*lchild,*rchild;//左右孩子指针intdepth;//以该结点为根的子树的深度}BiTNode,*BiTree;a.试编写一递归函数BiTreeDepth(BiTreeT),计算二叉树T中每个结点的depth值,函数的返回值为树T的深度。b.在a的基础上(即已求出二叉树中每个结点的depth值),编写一递归函数BiTreeBalance(BiTreeT),判断二叉排序树T是否为平衡(pínghéng)二叉树,如果是平衡(pínghéng)二叉树,则函数的返回值为真。a.intBiTreeDepth(BiTreeT){intldepth,rdepth;if(!T)return-1;ldepth=BiTreeDepth(T->lchild);rdepth=BiTreeDepth(T->rchild);if(ldepth>=rdepth)T->depth=ldepth+1;elseT->depth=rdepth+1;returnT->depth;}b.StatusBiTreeBalance(BiTreeT){intldepth,rdepth;if(T==NULL)returnTRUE;if(T->lchild)ldepth=T->lchild->depth;elseldepth=-1;if(T->rchild)rdepth=T->rchild->depth;elserdepth=-1;lrdepth=ldepth–rdepth;if((lrdepth==0||lrdepth==1||lrdepth==-1)&&(BiTreeBalance(T->lchild)&&BiTreeBalance(T->rchild))returnTRUE;returnFALSE;}2007考研(kǎoyán)试题2007考研(kǎoyán)试题2008考研(kǎoyán)试题试编写先根遍历树的递归算法PreOrderTree(T,visit),其中T为要遍历的树,visit为访问函数,树的存储结构采用(cǎiyòng)孩子兄弟表示法,其类型定义如下:typedefstructTreeNode{ElementTypedata;structTreeNode*FirstChild;structTreeNode*NextSibling;}TreeNode,*Tree;树和二叉树—2009试题(shìtí)树和二叉树—2009试题(shìtí)树和二叉树—2009考博试题(shìtí)树和二叉树—2009考博试题(shìtí)图—2005试题(shìtí)图—2006试题(shìtí)在求连通网的最小生成树时,普里姆(Prim)算法(suànfǎ)适用于___________,克鲁斯卡尔(Kruskal)算法(suànfǎ)适用于____________。图—2008试题(shìtí)图—2009试题(shìtí)图—2009试题(shìtí)图—2009考博试题(shìtí)图—2009考博试题(shìtí)(1)