Java icon indicating copy to clipboard operation
Java copied to clipboard

fix mistake in the heapsort() method and add MaxPriorityQueue.java

Open yuhsin7676 opened this issue 3 years ago • 3 comments

Describe your change:

Fixes https://github.com/TheAlgorithms/Java/issues/3515

  • Fix a bug in the algorithm heapsort() in the MinPriorityQueue.java of com.thealgorithms.datastructures.heaps package. heapsort() method gave an error when size < capacity. Also add MaxPriorityQueue.

References

Checklist:

  • [x] I have read CONTRIBUTING.md.
  • [x] This pull request is all my own work -- I have not plagiarized.
  • [x] I know that pull requests will not be merged if they fail the automated tests.
  • [ ] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • [x] All new Java files are placed inside an existing directory.
  • [x] All filenames are in all uppercase characters with no spaces or dashes.
  • [x] All functions and variable names follow Java naming conventions.
  • [x] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • [x] If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

yuhsin7676 avatar Oct 12 '22 11:10 yuhsin7676

Please replace main()s with JUnit tests

OK

yuhsin7676 avatar Oct 19 '22 16:10 yuhsin7676

I think there are many files that don't have any dedicated test files, rather just a main() inside the class. there may be some contributors who can write some test cases for those files. should I make some issues about creating test files

debasishbsws avatar Oct 19 '22 16:10 debasishbsws

@debasishbsws that'd be nice!

siriak avatar Oct 19 '22 17:10 siriak

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 27 '22 00:12 github-actions[bot]

Please reopen this pull request once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions!

github-actions[bot] avatar Jan 04 '23 00:01 github-actions[bot]