-
-
Notifications
You must be signed in to change notification settings - Fork 43.9k
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
treap not working expected when splitting on value that existed #7854
Comments
additional note: once you update the |
…ms#7854 Corrected the split docstring to reflect the working of the function, i.e., elements equal to the split value will be contained by left subtree, which before correction the docstring stated to be contained in the right subtree.
Solved the issue through the request #7899. Changed the docstring according to the standard implementation found on resources available online. More details in the pull request description. |
Repository commit
master
Python version (python --version)
any
Dependencies version (pip freeze)
any
Expected behavior
according to the docstring of treap's split function below, when we split a treap into two, the left treap should contain values less than split value, and the right should contain values greater or equal than split value.
Which means the expected return of following code should be:
Actual behavior
However, the actual behavior of the same code is the opposite:
This can be fixed by either changing the docstring or by using
<=
instead of<
in the if condition withinsplit
function.The text was updated successfully, but these errors were encountered: