mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-25 19:22:27 +08:00
build
This commit is contained in:
@ -427,7 +427,7 @@ comments: true
|
||||
/* 构建二叉树 */
|
||||
TreeNode *buildTree(int *preorder, int preorderSize, int *inorder, int inorderSize) {
|
||||
// 初始化哈希表,存储 inorder 元素到索引的映射
|
||||
int *inorderMap = (int *)malloc(sizeof(int) * MAX_N);
|
||||
int *inorderMap = (int *)malloc(sizeof(int) * MAX_SIZE);
|
||||
for (int i = 0; i < inorderSize; i++) {
|
||||
inorderMap[inorder[i]] = i;
|
||||
}
|
||||
|
Reference in New Issue
Block a user