Skip to main content

A simple implementation of the Min Heap and Max Heap

Project description

Hipster

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

Installation

Use pip to install the module

  • pip install hipster

Usage

  • >>> from hipster.heap import MaxHeap
  • >>> max_heap = MaxHeap()
  • >>> max_heap.push(6)
  • >>> max_heap.push(9)
  • >>> max_heap.push(3)
  • >>> max_heap.peek()
  • >>> 9
  • >>> max_heap.pop()
  • >>> 9
  • >>> max_heap.pop()
  • >>> 6

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hipster-1.0.3.tar.gz (1.7 kB view hashes)

Uploaded Source

Built Distribution

hipster-1.0.3-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page