123456789101112131415161718
void sort() { node *temp=first; while (temp!=NULL) { if(temp->number>temp->next->number) { temp->prev->next=temp->next->next;//1st temp->next->prev=temp->prev;//2nd temp->prev=temp->next;//3rd temp->next=temp->next->next;//4th temp->prev->next=temp;//5th temp->next->prev=temp;//6th } temp=temp->next; } }
temp->prev->next = temp->next;
NULL->prev
first