int distance( pq )
tree pq;
{ return( pq==NULL ? 0 : pq->dist ); };
fixdist( pq )
tree pq;
{
tree temp;
if ( distance(pq->left) < distance(pq->right) ) {
temp = pq->right;
pq->right = pq->left;
pq->left = temp;
};
pq->dist = distance(pq->right) + 1;
};
|