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