Hipster
Description
Hipster provides a thread-safe implementation of the MinHeap and MaxHeap. For adding an object to the heap, the object needs to encapsulate it's comparison logic.
Object Usage
class CustomObject:
def __init__(self, a, b):
pass
# The object needs to implement the following methods
def __eq__(self, other):
pass
def __ne__(self, other):
pass
def __lt__(self, other):
pass
def __le__(self, other):
pass
def __gt__(self, other):
pass
def __ge__(self, other):
pass
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
Changelog
1.0.6
Added clear, fixed README
Metadata
Release files for hipster 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hipster-2.0.0.tar.gz | 2.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hipster-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.4 kB
Release files / hipster-2.0.0.tar.gz
| Download URL | hipster-2.0.0.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58c957a7023bd8cdb3312e3de622c93880655554c8f4a88e6371891e9c9e8bbb
|
|
BLAKE2b-256 checksum How to use checksums |
251dd99940c0952053e0ba82a8cd5d9e83be12a21a64336f7f97e6e121824132
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5rc1
|
Release files / hipster-2.0.0-py3-none-any.whl
| Download URL | hipster-2.0.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b5be61779ee2a92937c84f8f72cc8e1633646041bde836624a08537e2fcb114
|
|
BLAKE2b-256 checksum How to use checksums |
44e179e6c65d3f16c33bcd1affd86ebfb8ce08aca09ef9cd770e9d9d4d4b1b67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5rc1
|