Free memory after removing

a node from a LinkedList or TreeNode.
This commit is contained in:
Yudong Jin
2023-01-02 19:53:55 +08:00
parent 6b02449f22
commit 410c5d6b62
20 changed files with 69 additions and 140 deletions
@@ -293,6 +293,8 @@ comments: true
ListNode* P = n0->next;
ListNode* n1 = P->next;
n0->next = n1;
// 释放内存
delete P;
}
```