-
Notifications
You must be signed in to change notification settings - Fork 8
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
Issue popping when using custom comparator #31
Comments
Hello @bjrnt, thanks for your feedback. I will try it within the |
It should be fixed now. To allow I have added tests for custom heaps with custom comparators, and improved the existing ones. @bjrnt Could you try the Thanks :) |
Yep, working great now! Thanks for the quick fix! :) |
Hi,
Thanks for the library! I've had great use of it in a lot of online coding interviews. :)
Here's a quick reproduction of a bug I found when using custom comparators:
After some digging, I found that inside
getPotentialParent
sometimes callsthis.compare
with anundefined
value. Adding a quicktypeof this.heapArray[j] !== "undefined" &&
to the function solves the issue but I am not sure if this is the best way to handle it. I'd be happy to send a PR with tests if you think this is a good solution to the problem.The text was updated successfully, but these errors were encountered: