To ask who the second image wavy lines what is the function of a part of the statement
CodePudding user response:
Assume that p - & gt; Next - & gt; H1 to h1 It s - & gt; After the next=p.n ext, s - & gt; Next, & gt; H1 s next to h1, it ok
Then p - & gt; Next=s; Becomes a p - & gt; Next, & gt; S p s next orientation, so the results into a p - & gt; Next, & gt; S - & gt; Next, & gt; H1 If there is no s - & gt; Next=p.n ext, h1 is I can't find it, because the p - & gt; Next=s yes p next abandoned the h1, points to the s, so no h1 node just want it, h1 node is lost? So keep up to the h1 first and then how to keep? Keep in s next directly, so is the s - & gt; Next=p.n ext
Actually using a temporary variable, it is estimated that LZ is understand The Node * h1=p - & gt; Next;//keep the h1 next point to the node p P - & gt; Next=s;//and then the next point to p s S - & gt; Next=h1;//and then s next to the h1 This also reached the p - & gt; Next, & gt; S - & gt; Next, & gt; H1
So the s - & gt; Next=p.n ext just omit the Node * h1=p - & gt; Next use temporary variable