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


Leftist trees insertion (Pascal version available)


tree insert( new, pq ) tree new, pq; { if ( pq==NULL ) return( new ); else if ( pq->k > new->k ) { pq->right = insert( new, pq->right ); fixdist( pq ); return( pq ); } else { new->left = pq; return( new ); } };

C source (516.ins.c) Pascal source (516.ins.p)



© Addison-Wesley Publishing Co. Inc.