Вот мой код:
struct branch{
long order=0;
branch * next = NULL;
};
branch * head = NULL;
void SuperSort(){
if(head){
branch * miss = new branch;
miss->next = head;
while(miss->next->next){
branch * worry = new branch;
worry->next = miss->next;
branch * pass = new branch;
pass = miss->next->next;
while(pass){
if(worry->next->order<pass->order)
worry->next = pass;
branch * buf = new branch;
buf->next = miss->next;
if(miss->next==head){
head->next = worry->next->next;
worry->next = head;
head = worry->next;
worry->next->next = buf->next;
} else {
miss->next->next = worry->next->next;
miss->next = worry->next;
worry->next->next = buf->next->next;
worry->next = buf->next;
}
pass = pass->next;
}
miss->next = miss->next->next;
}
}
}
А так лучше?