Several bug fixes.

This commit is contained in:
krahets
2023-10-29 00:09:54 +08:00
parent c37f0981f0
commit db5d1d21f3
9 changed files with 14 additions and 17 deletions

View File

@@ -6,13 +6,13 @@
#include "../utils/common.h"
/* 数组表示下的二叉树结构 */
/* 数组表示下的二叉树结构 */
typedef struct {
int *tree;
int size;
} ArrayBinaryTree;
/* 构造方法 */
/* 构造函数 */
ArrayBinaryTree *createArrayBinaryTree(int *arr, int arrSize) {
ArrayBinaryTree *abt = (ArrayBinaryTree *)malloc(sizeof(ArrayBinaryTree));
abt->tree = malloc(sizeof(int) * arrSize);
@@ -155,7 +155,7 @@ int main() {
free(res);
// 释放内存
free(root);
freeMemoryTree(root);
free(abt);
return 0;