Metadata-Version: 2.4
Name: k3heap
Version: 0.1.8
Summary: Binary min heap implemented with reference
Author-email: Zhang Yanpo <drdr.xp@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/pykit3/k3heap
Project-URL: Documentation, https://k3heap.readthedocs.io
Keywords: python,heap,binary-heap,data-structure
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: k3ut
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Provides-Extra: publish
Requires-Dist: build; extra == "publish"
Requires-Dist: twine; extra == "publish"
Requires-Dist: pk3; extra == "publish"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5; extra == "docs"
Requires-Dist: mkdocs-material>=9.0; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
Dynamic: license-file

# k3heap

[![Action-CI](https://github.com/pykit3/k3heap/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3heap/actions/workflows/python-package.yml)
[![Build Status](https://travis-ci.com/pykit3/k3heap.svg?branch=master)](https://travis-ci.com/pykit3/k3heap)
[![Documentation Status](https://readthedocs.org/projects/k3heap/badge/?version=stable)](https://k3heap.readthedocs.io/en/stable/?badge=stable)
[![Package](https://img.shields.io/pypi/pyversions/k3heap)](https://pypi.org/project/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

```python

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>


[pykit3]: https://github.com/pykit3
