The Documentation with more info.
Heap is the data structure that I often has to drop into my Leetcode solutions. I implemented MinHeap
and MaxHeap
for educational purpose from scratch once, and started using it for Leetcode problems. This project exists so one can quickly copy-and-paste a Heap to a [Swift] Leetcode solutions.
- Simple AF
- Tested
- Minificated (Less lines of code)
- Performant enough
- Code is duplicated on purpose: the idea is one uses either MaxHeap or MinHeap by copying and pasting the source code into Leetcode code editor.
- API of both Heaps is unified, except
extractMin()
vs.extractMax()
to be more descriptive. It is a personal choice. - I am toying with this idea of minifying the source code, and creating a release versions of it. Similar to how minification is often done with JavaScript. In the end of the day, for the goals of this project, the code should not be readable as far as it delivers expected behavior.
- Add test to
MinHeap
- Add tests to
MaxHeap
- Script to minify
MinHeap
- Script to minify
MaxHeap
- Move code comments to the documentation
- Add performance tests
Problems that can be solved with Heap
data structure.