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

程序填空题:LL Rotation

Luz4年前 (2021-05-10)题库1087
The function `LL_Rotation` is to do right-left rotation to the trouble-finder tree node `T` in an AVL tree.

```c++
typedef struct TNode *Tree;
struct TNode {
int key, h;
Tree left, right;
};

Tree LL_Rotation( Tree T )
{
Tree L;

L = T->left;
@@[T->left](2) = L->right;
L->right = T;
/* Update heights */
T->h = maxh(Height(T->left), Height(T->right)) + 1;
L->h = @@[maxh(Height(L->left), T->h) + 1](2);

return L;
}
```





答案:
第1空:T->left

第2空:maxh(Height(L->left), T->h) + 1

发表评论

访客

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