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

[Advanced/C++/1066] bug report #126

Open
Dawn-K opened this issue Dec 2, 2019 · 0 comments
Open

[Advanced/C++/1066] bug report #126

Dawn-K opened this issue Dec 2, 2019 · 0 comments

Comments

@Dawn-K
Copy link

Dawn-K commented Dec 2, 2019

虽然此题保证了输入数据是互不相同的,但是模板中

root->right = insert(root->right, val);
if (getHeight(root->left) - getHeight(root->right) == -2)
      root = val > root->right->val ? rotateLeft(root) : rotateRightLeft(root);

其中的判断应该修改为 val > root->right->val ,否则在多次插入同一个数据时会死循环.

hack数据

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

No branches or pull requests

1 participant