This commit is contained in:
Xu Bai
2019-07-10 23:12:54 +08:00
parent 0b58810c89
commit 0dc784dbf5
2 changed files with 36 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
{
"python.pythonPath": "C:\\ProgramData\\anaconda\\python.exe",
"files.associations": {
"cstdio": "c"
"cstdio": "c",
"stdlib.h": "c"
}
}

View File

@@ -2,11 +2,12 @@
* @Author: Xu Bai
* @Date: 2019-07-09 22:50:41
* @LastEditors: Xu Bai
* @LastEditTime: 2019-07-10 22:45:47
* @LastEditTime: 2019-07-10 23:12:44
*/
#include "stdlib.h"
#include "stdio.h"
#include "io.h"
#include "math.h"
#define OK 1
#define ERROR 0
@@ -77,3 +78,35 @@ Status CreateBiTree(SqBiTree T)
/*<2A><>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫһ<C8AB><D2BB> */
#define ClearBiTree InitBiTree
Status BiTreeEmpty(SqBiTree T)
{
if (T[0] == Nil)
{
return TRUE;
}
else
{
return FALSE;
}
}
int BiTreeDepth(SqBiTree T)
{
int i, j = -1;
for (i = MAX_TREE_SIZE - 1; i >= 0; i--)
{
/*<2A>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
if (T[i] != Nil)
{
break;
}
}
i++;
do
{
j++;
} while (i >= powl(2, j));
/*<2A><><EFBFBD><EFBFBD>2<EFBFBD><32>j<EFBFBD><6A><EFBFBD><EFBFBD> */
return j;
}