最后再删除头结点
void Del(LinkList &L)
{LNode *p,q,*mp,*mq;while(L->next!=L){p=L->next;q=L;mp=p;mq=q;while(p!=L){if(p->data<mp->data){mp=p;mq=q;}q=p;p=p->next;}printf("%d",mp->data);mq->next=mp->next;free(mp);}free(L);
}
最后再删除头结点
void Del(LinkList &L)
{LNode *p,q,*mp,*mq;while(L->next!=L){p=L->next;q=L;mp=p;mq=q;while(p!=L){if(p->data<mp->data){mp=p;mq=q;}q=p;p=p->next;}printf("%d",mp->data);mq->next=mp->next;free(mp);}free(L);
}