(p0开空间,赋值、循环判断移动指针、num<p1->data,分头分中,否则为尾部插入)
dnode* insert(dnode *head,int num){
dnode *p1,*p0;
p1=head;
p0=(dnode*)malloc(sizeof(dnode));
p0->data=num;
while(num>p1->data&& p1->next!=NULL)
p1=p1->next;
if(num<=p1->data){
if(p1==head){
p0->next=p1;
p1->pre=p0;
head=p0;
}
else{
p1->pre->next=p0;
p0->next=p1;
p0->pre=p1->pre;
p1->pre=p0;
}
}
else{
p0->next=NULL;
p0->pre=p1;
p1->next=p0;
}
return head;
}