Iterative selection sort for linked list |  ; Traverse the List ; Traverse the unsorted sublist ; Swap Data
function selectionSort ( head ) { var temp = head ; while ( temp ) { var min = temp ; var r = temp . next ; while ( r ) { if ( min . data > r . data ) min = r ; r = r . next ; } var x = temp . data ; temp . data = min . data ; min . data = x ; temp = temp . next ; } }