Insert, there are two general double linked list pointer, a pointer to a node in the (insert is set to the position of p is a pointer), can be in front of the nodes in the node at the back of the insert, there is a nodes pointing to insert (set to a pointer q), as shown in (serial number and code number)
1: p - & gt; The prior - & gt; Next=q;
Since there is only one pointer to double linked list, so let's say its precursors or subsequent becomes p - & gt; The prior and p - & gt; Next, this is the address of the q pointer is assigned to p nodes of precursor referring to next
2: q - & gt; Next=p;
3: q - & gt; The prior=p - & gt; The prior;
4: p - & gt; The prior=q;
Why is the link to order?
First of all, there is only one pointer to double linked list, for p
P - & gt; The prior, and p - & gt; The prior - & gt; Next, these two points to is of vital importance to the two point to assignment, must after the assignment doesn't make the list broken cases (that is, can't use p said the two point) to their assignment, in other words: to use this two point, give their assignment,
CodePudding user response:
CodePudding user response:
Double linked list to insert the new node that four code execution order is there any requirement