mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-25 11:04:18 +08:00
Update arrayToTree() and treeToArray() for C.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user