Update arrayToTree() and treeToArray() for C.

This commit is contained in:
krahets
2023-10-27 01:04:17 +08:00
parent 5b1a219b8b
commit 0e10274bb4
4 changed files with 57 additions and 78 deletions

View File

@@ -19,13 +19,13 @@ void testListNode() {
void testTreeNode() {
int nums[] = {1, 2, 3, INT_MAX, 5, 6, INT_MAX};
int size = sizeof(nums) / sizeof(int);
TreeNode *root = arrToTree(nums, size);
TreeNode *root = arrayToTree(nums, size);
// print tree
printTree(root);
// tree to arr
int *arr = treeToArr(root);
int *arr = treeToArray(root, size);
printArray(arr, size);
}