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

程序填空题:BinQueue_Insert

Luz4年前 (2021-05-10)题库514
The function `BinQueue_Insert` is to insert `X` into a binomial queue `H`, and return `H` as the result.

```c++
BinQueue 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

发表评论

访客

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