File: README.md

package info (click to toggle)
golang-github-mailgun-minheap 0.0~git20170619.3dbe6c6-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 92 kB
  • sloc: makefile: 18
file content (35 lines) | stat: -rw-r--r-- 598 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
**This repo is deprecated, Renamed to PriorityQueue and moved to http://github.com/mailgun/holster**

[![Build Status](https://drone.io/github.com/mailgun/minheap/status.png)](https://drone.io/github.com/mailgun/minheap/latest)

minheap
=======

Slightly more user-friendly heap on top of containers/heap.

```go

import "github.com/mailgun/minheap"
	

func toEl(i int) interface{} {
	return &i
}

func fromEl(i interface{}) int {
	return *(i.(*int))
}

mh := minheap.NewMinHeap()

el := &minheap.Element{
   Value:    toEl(1),
   Priority: 5,
}

mh.PushEl(el)
mh.PeekEl()
mh.Len()
mh.PopEl()

```