Represent null with INT_MAX in C, C++.

This commit is contained in:
krahets
2023-04-18 14:31:23 +08:00
parent ed8fa6aea3
commit 6723cdbc7e
11 changed files with 35 additions and 26 deletions

View File

@@ -49,7 +49,7 @@ int *levelOrder(TreeNode *root, int *size) {
int main() {
/* 初始化二叉树 */
// 这里借助了一个从数组直接生成二叉树的函数
int nums[] = {1, 2, 3, NIL, 5, 6, NIL};
int nums[] = {1, 2, 3, 4, 5, 6, 7};
int size = sizeof(nums) / sizeof(int);
TreeNode *root = arrToTree(nums, size);
printf("初始化二叉树\n");