Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Node* sort_list(Node* head)
- {
- Node* tempNode = NULL;
- Node* tempHead = head;
- Node* tempNext = head->next;
- while(tempNext!=NULL){
- if(tempHead->key > tempNext->key){
- tempNode = tempHead;
- tempHead = tempNext;
- tempNode->next = tempNode->next->next;
- tempHead->next = tempNode;
- tempNext = tempHead->next;
- print_list(tempHead);
- }
- else{
- tempHead = tempHead->next;
- tempNext = tempNext->next;
- }
- }
- return head;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement