-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Removed array Insertion and added numbers Fixes: #1341 #1372
Removed array Insertion and added numbers Fixes: #1341 #1372
Conversation
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.
That comment should probably be removed or turned into a test case. Either way this change is an improvement already though.
@ROHAN13498 are you interested in implementing the test cases? Cause I see no point in improving upon something that is explicitly disallowed by the contribution guidelines. |
Done. I will work on it. |
Hey,There is no testcases file for maxheap should I create a newfile and work on it? |
Yes you should. |
The current situation is a bit awkward; we have a max heap, a min heap, and a priority queue, all of which are more or less based on similar code. This should ideally be deduplicated; max and min heap can effectively use the same code with a different comparison function, and a priority queue should just add an index from element to position in heap on top of that. |
So you are suggesting that Instead of having separate implementations for Max Heap and Min Heap, it's better to create a single generic heap data structure that can handle both max and min heaps by using a comparison function to determine the order of elements. Should I work on implementing this single heap data structure or write tests for max heap? |
Yes (though my suggestion goes even further: we could deduplicate some heap and priority queue code by making the priority queue extend or use the heap, but you don't need to do this because it is trickier).
The former; the latter would pretty much be manual test duplication, which seems pretty unnecessary to me. |
I'll start by working on test cases file for maxheap data structure for now . Once that's in place, I'll try to tackle code deduplication. |
As said, I don't think that's a good idea. You will be duplicating min heap tests effectively. |
Hey @appgurueu @raklaptudirm I have deduplicated the codes of min heap and maxheap into single binaryheap class should I create a issue for it and create a PR or should I do PR directly. |
know more
Fixes: #1341
Describe your change:
Checklist:
Example:
UserProfile.js
is allowed butuserprofile.js
,Userprofile.js
,user-Profile.js
,userProfile.js
are notFixes: #{$ISSUE_NO}
.