mirror of
https://github.com/by777/dataStructureForC.git
synced 2026-02-02 17:48:51 +08:00
补充
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"python.pythonPath": "C:\\ProgramData\\anaconda\\python.exe",
|
||||
"files.associations": {
|
||||
"cstdio": "c"
|
||||
"cstdio": "c",
|
||||
"stdlib.h": "c"
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user