******** fig6.27 ********** /* For merge1, H1 has smaller root, H1 and H2 are not NULL */ PRIORITY_QUEUE merge1( PRIORITY_QUEUE H1, PRIORITY_QUEUE H2 ) { /*1*/ if( H1->left == NULL ) /* single node */ /*2*/ H1->left = H2; /* H1->right is already NULL,H1->npl is already 0*/ else { /*3*/ H1->right = merge( H1->right, H2 ); /*4*/ if( H1->left->npl < H1->right->npl ) /*5*/ swap_children( H1 ); /*6*/ H1->npl = H1->right->npl + 1; } /*7*/ return H1; }