Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubt?return this.rotationLR(node.left); #7

Open
canfeit opened this issue Jun 12, 2020 · 1 comment
Open

Doubt?return this.rotationLR(node.left); #7

canfeit opened this issue Jun 12, 2020 · 1 comment

Comments

@canfeit
Copy link

canfeit commented Jun 12, 2020


I think this line should be:

return this.rotationLR(node);

Why use left?

@hefeng6500
Copy link
Contributor

I think this line should be:

return this.rotationLR(node);

Why use left?

Hi,canfeit!

The author is correct,the function of rotationLR params is node.left not node, why ? maybe you should review rotationLR Function details.

first, use node.left rotate to the left, node.left.right get balanced
second, use node rotate to the right, node.left get balanced

rotationLR(node) {
    node.left = this.rotationRR(node.left);
    return this.rotationLL(node);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants