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

程序填空题:BinQueue_DeleteRoot

Luz4年前 (2021-05-10)题库768
The function `DeleteRoot` is to delete the root of a subtree with index `Ind` from a binomial queue `H`. The rest of the subtree is then stored as a new binomial queue and returned.

```c++
BinQueue DeleteRoot( BinQueue H, int Ind )
{
BinTree OldRoot, SubTree;
BinQueue NewBinQ;
int i;

OldRoot = H->TheTrees[Ind];
SubTree = OldRoot->LeftChild;
free(OldRoot);
NewBinQ = Initialize();
NewBinQ->CurrentSize = @@[(1< for ( @@[i=Ind-1; i>=0; i--](3) ) {
NewBinQ->TheTrees[i] = SubTree;
SubTree = SubTree->NextSibling;
NewBinQ->TheTrees[i]->NextSibling = NULL;
}
return NewBinQ;
}
```






答案:
第1空:(1<
第2空:i=Ind-1; i>=0; i--

发表评论

访客

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