https://github.com/ralgond/topk
A data structure for finding the top k elements
https://github.com/ralgond/topk
go topk
Last synced: 3 months ago
JSON representation
A data structure for finding the top k elements
- Host: GitHub
- URL: https://github.com/ralgond/topk
- Owner: ralgond
- License: mit
- Created: 2023-09-14T01:47:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-15T02:42:26.000Z (over 1 year ago)
- Last Synced: 2025-01-09T06:47:01.267Z (5 months ago)
- Topics: go, topk
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# topk
A data structure for finding the top k elements## how to use
```go
package mainimport (
"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())
}
```