如何改成双向循环链表的排序
void sort_d_list( struct d_list *head ){
struct d_list *p, *head1, *p1, *p2, *pre;
p = head;
head1 = NULL;
p2 = NULL;
while( p != NULL )
{
pre = p->next;
p->next = NULL;
if( head1 == NULL )
head1 = p;
else
{
p1 = head1;
p2 = NULL;
while( (p1!=NULL) && (p->data > p1->data) )
{
p2 = p1;
p1 = p1->next;
}
if( p2 == NULL )
{
p->next = head1;
head1 = p;
}
else
{
p->next = p1;
p2->next = p;
}
}
p = pre;
}
//return head1;
}