Just write the code using following steps:
1. Start two loops.
2. In the outer loop access all the nodes except the last node.
3. in the inner loop access all nodes the nodes from the node following the node pointed by the variable in the outer loop
4. then check the values and accordingly swap the nodes.
5. go to the next node in the inner loop
6. go to the next node in the outer loop
To add to this one more hint.,
PREVIOUS_NODE;
TEMP_NODE; //
TEMP_NODE->PTR = NEXT_NODE->PTR;
if(CURRENT_NODE->VALUE < NEXT_NODE->VALUE)
{
NEXT_NODE->PTR = PREVIOUS_NODE->PTR;
PREVIOUS_NODE->PTR = CURRENT_NODE->PTR;
CURRENT_NODE->PTR = TEMP_NODE->PTR ;
}
ALL the 4 TEMP_NODE,PREVIOUS_NODE,CURRENT_NODE,NEXT_NODE belong to the same linked list and the rest is just traversal and looping.