a Container datatype wrapper for the Python standard library heapq module.
Install this library using pip
:
pip install heapq-container
from heapqueue import HeapQueue
def heapsort(iterable):
h = HeapQueue(iterable)
return [h.pop() for _ in range(len(h))]
heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])
# -> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd heapq-container
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest