list delete( pq )
list pq;
{struct rec r;
list p, max;
if (pq==NULL) Error /*** Deleting from empty PQ ***/;
else {r.next = pq;
max = &r;
for (p=pq; p->next != NULL; p=p->next)
if (max->next->k < p->next->k) max = p;
max->next = max->next->next;
return( r.next );
}
};
|