Compares two adjacent elements and swaps if the first element is greater than the other one .
while ( curr -> next != NULL ) { temp = curr -> next ; while ( temp != NULL ) { if ( temp -> data < curr -> data ) { int t = temp -> data ; temp -> data = curr -> data ; curr -> data = t ; } temp = temp -> next ; } curr = curr -> next ; } }