Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Python implementation of java TreeMap. Hope similar data structure can be added to python offical library.

Project description

HashHeap

Python's implementation of java's TreeMap. Hope similar data structure can be added to python offical library.

Install

  • Install via $ pip install HashHeap .

How to use

  • $ from HashHeap import HashHeap .

    def init(self, desc=False): '''Initalize hashheap.
    :input: desc, ture for min heap, flase for max heap.
    :type: bool '''

    def size(self): '''Get the size of the hashheap.
    :input: None :type: None :return: Size of the hashheap :type: int '''

    def push(self, item): '''push item into hashheap.
    :input: item :type: type of item :return: None :type: None '''

    def pop(self): '''Remove and return the top of the HashHeap.
    :input: None :type: None :return: item in hashheap :type: type of item in hashheap '''

    def top(self): '''Return the top of the HashHeap without remove it.
    :input: None :type: None :return: item in hashheap :type: type of item in hashheap '''

    def remove(self, item): '''remove element in HashHeap in O(logn) time complexity.
    :input: param :type: dict :return: None :type: None '''

And ...

Pull requests are encouraged!

Project details


Release history Release notifications

This version

1.0.0

Download files

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

Files for HashHeap, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size HashHeap-1.0.0-py2.py3-none-any.whl (1.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size HashHeap-1.0.0.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page