Home > Back-end >  The list
The list

Time:10-08

The title https://leetcode-cn.com/problems/delete-middle-node-lcci/solution/li-mao-huan-tai-zi-fa-by-haleeey/

First handed in in this topic is to delete the current node (avoid into pits)
Thinking: to delete nodes only the next node address, so to bear on the train of thought is to pass the value and the address of the next node to the current node delete the next node
Node - & gt; Next=node - & gt; Next - & gt; Next;
Node - & gt; Next=node - & gt; Next - & gt; Next;

Useless garbage collection delete because recycling here

CodePudding user response:

Didn't you read
Still need to delete the
C + + without recycling
Then you need to change the data fields of the current node to the next node data fields
Instead of abcdef abddef
Then delete the second d
Behind the e node link to the first d
  • Related