Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 455 Bytes

README.md

File metadata and controls

21 lines (15 loc) · 455 Bytes

lua-binary-heap

Binary heap data structure implemented in lua.

Built as a class with kikito's middleclass which you will need as a dependency.

Usage

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.