-
Notifications
You must be signed in to change notification settings - Fork 313
Implemeted Treaps and CartesianTree
#235
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
Conversation
pydatastructs/trees/binary_trees.py
Outdated
| @@ -1,16 +1,20 @@ | |||
| from pydatastructs.utils import TreeNode | |||
| from pydatastructs.utils import CartesianTreeNode | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combine this import in line 1,
TreeNode, CartesianTreeNode|
Please reference this PR in your RGSoC application. |
|
Tests needed to increase the code coverage. Add them to |
Co-Authored-By: Gagandeep Singh <gdp.1807@gmail.com>
Co-Authored-By: Gagandeep Singh <gdp.1807@gmail.com>
Co-Authored-By: Gagandeep Singh <gdp.1807@gmail.com>
Co-Authored-By: Gagandeep Singh <gdp.1807@gmail.com>
Rotations fixed in Issue codezonediitj#234 with PR codezonediitj#238
|
Any updates? |
|
Will update soon by adding the tests |
|
Any news? |
|
This PR is almost ready. A few review comments(made above) need to be addressed. |
|
In addition, can you please provide a reference from where you used the tests? It would be easy to cross check if you are able to provide one. |
|
Please add a static method as follows, @classmethod
def methods(cls):
return ['method_1', 'method_2', ...., 'method_n']Merge |
Co-Authored-By: Gagandeep Singh <gdp.1807@gmail.com>
Co-Authored-By: Gagandeep Singh <gdp.1807@gmail.com>
Co-Authored-By: Gagandeep Singh <gdp.1807@gmail.com>
Co-Authored-By: Gagandeep Singh <gdp.1807@gmail.com>
Co-Authored-By: Gagandeep Singh <gdp.1807@gmail.com>
|
@Aimaanhasan Have you enabled
|
|
Please provide it in the comments. Including them in the docs is optional. I am making some API changes in your patch. Will push them shortly. |
Reference for tests for
|
|
Thanks for your patience. Merging. |
|
Likewise. I am glad I could contribute |
References to other Issues or PRs or Relevant literature
Closes #215
Closes #106
Brief description of what is fixed or changed
Implemented CartesianTree
In
insertmethod, it required an additional parameter,prioritycompared to theinsertmethod ofBinarySearchTree.The
insertmethod calls the insert of parent class i.eBinarySearchTree, then searches for the key, and converts theTreeNodeinserted intree, which isArrayForTrees, toCartesianTreeNodeand then do the rotations to satisfy heap property.The
deletemethod does the rotations first, to make the node a leaf and then calls the delete method of the parent class.Implemented Treap
In
insertmethod, it generates a priority which is not already generated before by maintaining a set by the name ofpriorities, and the calls theinsertmethod of the parent class withpriorityas random number generated.Other comments
Implemented
_left_rotateand_right_rotatemethods inCartesianTreebecause of Issue #234