c++ - What has gone wrong with this sorting code using Linked Lists? -
I want to say that I started learning C ++ now and I just got to enter, delete, Good catch, Finding element and element in position I have tried sorting to use bubble sort (?) And the program is crashing. Please help me
Structure node {Int data; Structure node * link; }; Typedf Structure node * NODE; NODE REIR (NODE Route) {NODE temp = root; While (temp! = NULL) {NODE curr = temp; Whereas (curr! = NULL) {if (curr-> Data> (curr-> link -> data) {int temp1 = curr-> Data; Curr-> Data = (curr- & gt; link) - & gt; Data; (Curr-> Link) - & gt; Data = temp1; } Curr = curr- & gt; Link; } Temp = temp- & gt; Link; } Return route; }
To put it in and also remove the function, but I have not copied here. If you want, I'll post the whole program.
Curr- & gt; If the link is zero or not data memeber causes a fault.
If (curr-> link! = Null & amp; curr- & gt; data & gt; - & gt; link) - & gt; Data)
Comments
Post a Comment