A simple implementation of the Min Heap and Max Heap
Project description
Hipster
Description
Hipster provides a simple implementation of the MinHeap and MaxHeap. The object being added to the respective heaps need to implement the comparator logic. The APIs are identical for MinHeap and MaxHeap
Dependencies
Python 3
Installation
pip install --upgrade hipster
Usage
from hipster.heap import *
max_heap = MaxHeap() # creates an empty max heap
max_heap.push(item) # pushes a new item on the heap
item = max_heap.peek() # returns the largest item from the heap without removing it
item = max_heap.pop() # pops an item off the max heap
max_heap.clear() # Removes all items from the heap
License
MIT
History
0.5
Added clear, fixed README
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hipster-0.5.tar.gz
(1.8 kB
view hashes)
Built Distribution
hipster-0.5-py3-none-any.whl
(3.0 kB
view hashes)