Open Dawn-K opened 4 years ago
虽然此题保证了输入数据是互不相同的,但是模板中
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 ,否则在多次插入同一个数据时会死循环.
val > root->right->val
hack数据
5 70 70 70 70 70
虽然此题保证了输入数据是互不相同的,但是模板中
其中的判断应该修改为
val > root->right->val
,否则在多次插入同一个数据时会死循环.hack数据