lheap

Leftist heap in Elixir

Install

In your mix.exs:

defp deps do
  [
    {:lheap, "~> 1.0.0"}
  ]
end

Then run mix deps.get.

API

Documentation is available in HexDocs.

LHeap.new/0, LHeap.new/1

Creates a new empty heap. When given an enumerable, it will populate the new heap with it.

LHeap.put/2

Puts a new value in a heap.

LHeap.min/1

Returns the minimum element of a heap.

LHeap.remove_min/1

Removes the minimum element from a heap.

LHeap.merge/2

Merges two heaps.

LHeap.sort/1

Sorts the given heap and returns a list.

License

MIT © Juan Soto