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

程序填空题:BinQ_DeleteRt

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

```c++
BinQ DeleteRt( BinQ H, int Pos )
{
BinTree OldRoot, SubTree;
BinQ NewBinQ;
int p;

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





答案:
第1空:(1<
第2空:p=Pos-1; p>=0; p--

发表评论

访客

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