程序填空题:Insert X into a binomial queue H
The function is to insert X into a binomial queue H.
```c++
BinQueue Insert( ElementType X, BinQueue H )
{
BinTree Carry;
int i;
H->CurrentSize ++;
Carry = malloc( sizeof( struct BinNode ) );
Carry->Element = X;
Carry->LeftChild = Carry->NextSibling = NULL;
i = 0;
while ( H->TheTrees[ i ] ) {
Carry = CombineTrees( Carry, @@[H->TheTrees[ i ]](3)); //combine two equal-sized trees
H->TheTrees[ i ++ ] = NULL;
}
@@[H->TheTrees[ i ] = Carry](3);
return H;
}
```
答案:
第1空:H->TheTrees[ i ]
第2空:H->TheTrees[ i ] = Carry
```c++
BinQueue Insert( ElementType X, BinQueue H )
{
BinTree Carry;
int i;
H->CurrentSize ++;
Carry = malloc( sizeof( struct BinNode ) );
Carry->Element = X;
Carry->LeftChild = Carry->NextSibling = NULL;
i = 0;
while ( H->TheTrees[ i ] ) {
Carry = CombineTrees( Carry, @@[H->TheTrees[ i ]](3)); //combine two equal-sized trees
H->TheTrees[ i ++ ] = NULL;
}
@@[H->TheTrees[ i ] = Carry](3);
return H;
}
```
答案:
第1空:H->TheTrees[ i ]
第2空:H->TheTrees[ i ] = Carry