题目:
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Supposed the linked list is 1 -> 2 -> 3 -> 4
and you are given the third node with value 3
, the linked list should become 1 -> 2 -> 4
after calling your function.
分析:
删除单链表中的一个结点,不包括尾结点
那么只有将下一个结点的信息赋值给当前信息,并且建一个Listnode* temp=node->next; 在最后delete temp;
这道题比较简单