You're welcome.
My point in #2 is that you shouldn't be swapping data at all. You leave the data where it is (in memory) and swap the pointers.
Example: Suppose there are 4 student structures stored in memory. Let these be A,B,C and D
and that A.next points to B, B.next points to C and C.next points to D.
A diagram of this may look like so:
Now suppose that in the sort() it is found that B.name > C.name. We would want to "swap" these two students in the list. We want to re-order the list and make it:
We have the next pointers to work with to accomplish this.
Step 1: Get A.next to point to C, but save the pointer to B first.
student* temp = A.next;// save the pointer to B
Then we can reassign A.next to point to C
A.next = B.next;// since B.next is pointing to C. Now A -> C
Step 2: Get B.next to point to D. C.next has this value
B.next = C.next;// now B -> D
Step 3: Finally make C.next point to B. This pointer was saved as temp.
C.next = temp;// Now C -> B
That completes the swap. NOTE: This is just an explanation of the logic behind the swap. The implementation of it must be worked out!
You will also need to deal with the special case where the "head" node is one of those being swapped.
Also, your sort() needs to go through the list multiple times - not just once. Suppose that in the above example that A.name > C.name. You must repeat the swap above to then get:
and so on.
Hope this helped. Feel free to reply with questions. It's your thread after all!