I have made insertion sort funtion for a doubly linked list , but its not working , i cant figure out the errors.If anybody can guide a bit. =|Code:void insertionSort() { node* temp=head; while(temp->next != NULL) { node* second =temp->next; if (second->exponent==temp->exponent) { temp=temp->next; } else { second->previous->next=second->next; second->next->previous=second->previous; if (head->exponent > second->exponent) { second->next=head; second->previous=NULL; head->previous=second; head= second; } node* current = head->next; while(current->exponent < second->exponent) { current=current->next; } second->next=current; second->previous=current->previous; current->previous->next=second; current->previous=second; } } }