mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-11 06:56:06 +00:00
Free memory after removing
a node from a LinkedList or TreeNode.
This commit is contained in:
@@ -293,6 +293,8 @@ comments: true
|
||||
ListNode* P = n0->next;
|
||||
ListNode* n1 = P->next;
|
||||
n0->next = n1;
|
||||
// 释放内存
|
||||
delete P;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user