Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/ralgond/topk

A data structure for finding the top k elements
https://github.com/ralgond/topk

go topk

Last synced: 5 days ago
JSON representation

A data structure for finding the top k elements

Awesome Lists containing this project

README

        

# topk
A data structure for finding the top k elements

## how to use
```go
package main

import (
"fmt"
"github.com/ralgond/topk"
)

func main() {
_topk := topk.NewTOPK(3)

_topk.Add2(3, 3)
_topk.Add2(4, 4)
_topk.Add2(6, 6)
_topk.Add2(1, 1)
_topk.Add2(2, 2)
_topk.Add2(5, 5)

fmt.Println(_topk.Dumps())
}
```