void swap(list_node * a, list_node * b) {
    int tmp = a->val;
    a->val = b->val;
    b->val = tmp;
}

list_node * selection_sort(list_node * head)
{
    //////在下面完成代码
    if(head == nullptr || head->next == nullptr) return head;
    for(list_node* i=head; i != nullptr; i = i->next) {
        for(list_node* j=i->next; j != nullptr; j = j->next) {
            if(j->val < i->val) swap(i,j);
        }
    }
    return head;
}