mirror of
https://github.com/krahets/hello-algo.git
synced 2025-12-16 03:59:18 +08:00
Fine-tune code and texts.
This commit is contained in:
@@ -74,12 +74,11 @@ vector<int> treeToVecor(TreeNode *root) {
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Free the memory allocated to a tree */
|
||||
/* 释放二叉树内存 */
|
||||
void freeMemoryTree(TreeNode *root) {
|
||||
if (root == nullptr)
|
||||
return;
|
||||
freeMemoryTree(root->left);
|
||||
freeMemoryTree(root->right);
|
||||
// 释放内存
|
||||
delete root;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user