removemax(LinkedList head){ LinkedList p,q; int max; if(head->next==NULL) return ; p=head->next; max=p->data; while(p->next){ p=p->next; if(p->data>max) max=p->data; } p=head; while(p->next){ q=p->next; if(q->data==max){ p->next=q->next; free(q); return; } p=p->next; } }
时间: 2024-11-19 22:08:20