There's a linked list "LIST" containing several nodes. Each node holds a value for an item, lets say x (can be 0 or a positive integer). What's the best way to sort these nodes with respect to x (in ascending order)?

For clarity, if there's something like the following:

NodeA (x=1) -> NodeB (x=4) -> NodeC (x=2)

the output should be: NodeA, NodeC, NodeB

Any help is greatly appreciated.