Sorted list insertion (
Pascal version
available)
list insert( new, pq ) list new, pq; {struct rec r; list p; r.next = pq; p = &r; while ( p->next != NULL && p->next->k > new->k ) p = p->next; new->next = p->next; p->next = new; return( r.next ); };
C
source (511.ins.c)
Pascal
source (511.ins.p)
©
Addison-Wesley
Publishing Co. Inc.