Trying to Sort a Linked List only by Manipulating Pointers
问题 I am trying to use Selection Sort to sort a Linked list. I can only manipulate the linked lists pointers and not change the keys. I think I have functional logic but, I just return the original unsorted sequence. bool nodeSwap(Node* head){ Node* next = head->next; if(next == NULL){ return head;} head->next = next->next; next->next = head; head = next; return next; } Node* sort_list(Node* head){ for(Node* n = head; n->next != NULL; n = n->next){ for(Node* n1 = head->next; n1 != NULL; n1 = n1-