An open API service indexing awesome lists of open source software.

https://github.com/blaknite/lua-binary-heap

Binary heap data structure implemented in lua.
https://github.com/blaknite/lua-binary-heap

binary-heap lua

Last synced: 3 months ago
JSON representation

Binary heap data structure implemented in lua.

Awesome Lists containing this project

README

        

# lua-binary-heap
Binary heap data structure implemented in lua.

Built as a class with [kikito's middleclass](https://github.com/kikito/middleclass) which you will need as a dependency.

## Usage

```lua
heap = Heap:new() -- creates a min heap
=> Heap

heap:insert(3, 'first payload')
=> nil
heap:insert(1, 'second payload')
=> nil

weight, payload = heap:pop()
=> 1, 'second payload'
```

For all methods and their usage see comments within `heap.lua`.