Leetcode 237 Delete Node in a Linked List 链表

如题 删除是要注意让现在的链表等于下一个链表的值

1 class Solution {
2 public:
3     void deleteNode(ListNode* node) {
4         ListNode *nextnode = node ->next;
5         *node = *nextnode;
6         node->next = nextnode ->next;
7         delete nextnode;
8     }
9 };

 

posted @ 2016-01-15 12:48  Breeze0806  阅读(109)  评论(0编辑  收藏  举报