k3heap is a binary min heap implemented with reference
Project description
k3heap
k3heap is a binary min heap implemented with reference
k3heap is a component of pykit3 project: a python3 toolkit set.
In this module RefHeap is a binary min heap implemented with reference: a parent has two references to two children and a child has a parent reference to its parent.
RefHeap is not thread safe::
import k3heap
h = k3heap.RefHeap()
x = []
h.push(x)
h.push(x) # ValueError
h.push([]) # OK
Install
pip install k3heap
Synopsis
import k3heap
h = k3heap.RefHeap([5, 1, 4, 2, 3])
while h.size > 0:
print(h.pop())
Author
Zhang Yanpo (张炎泼) drdr.xp@gmail.com
Copyright and License
The MIT License (MIT)
Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com
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
k3heap-0.1.6.tar.gz
(4.1 kB
view hashes)
Built Distribution
k3heap-0.1.6-py3-none-any.whl
(5.6 kB
view hashes)