-->
当前位置:首页 > 题库 > 正文内容

程序填空题:Insert X into a binomial queue H

Luz4年前 (2021-05-10)题库1017
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

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。