Heap Sort [Java]
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 487
- PR merge metrics
- No merged PRs in 30d
Description
#### This issue is about Heap Sort [Java] (https://github.com/iiitv/algos/blob/master/heap_sort/HeapSort.java).
- [x] Issue Title is in form `Heap Sort [Java]`.
- [x] I searched or browsed the repo’s other issues to ensure this is not a duplicate.
- [x] This Algo/DS is worth adding to this repository.
- [x] Assign this issue to me (I want to work on this).
- [x] I ensure that I am not already assigned to 2 or more issues.
- [x] I will send my PR only after I'm assigned to this issue by any maintainer.
- [x] I understand that I will be unassigned from this issue if I fail to send a PR for this within a week.
I think this code can be improved in these ways:
1. Add an overloaded version that accepts a Comparator.
2. Do a better separation of concerns: there should a class PriorityQueue which manages the responsibility of creating the heap and it's operation, and let the method use it.
3. Use the principle of not mixing levels of abstraction on a method to provide a public method that reads like prose, and other methods that hide the implementation details.
4. Improve documentation: current implementation there's no mention of what a heap is and how do you represent it as an array. This documentation would make it easier to understand the algorithm.
Contributor guide
Assessment
This issue has not been assessed yet.