📄 习题3-求二叉树深度.c
字号:
#include <stdio.h>
#include "datastru.h"
#include <malloc.h>
#include "二叉树.c"
int treehight(BTCHINALR *bt)
{ int lh, rh, h;
if(bt == NULL)
h = 0;
else
{ lh = treehight(bt->lchild);
rh = treehight(bt->rchild);
h = (lh > rh ? lh : rh) + 1; }
return h;
}
main( )
{ BTCHINALR *bt;
int treeh;
bt = createbt( );
treeh = treehight(bt);
printf("\n二叉树深度 = %d\n\n",treeh);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -