[Home]
[Contents]
[Chapter]
[Previous Algorithm]
[Next Algorithm]


Unsorted list deletion


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 ); } };

C source (511b.del.c)



© Addison-Wesley Publishing Co. Inc.