xcounter

package
v0.0.0-...-89edfd8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

func New

func New() *Counter

func (*Counter) AddItems

func (c *Counter) AddItems(items ...interface{})

func (*Counter) Get

func (c *Counter) Get(item interface{}) int

func (*Counter) MostCommon

func (c *Counter) MostCommon(n int) (items []CounterItem)

TODO: is it possible to get the most common without popping and pushing? O(n log k)

type CounterItem

type CounterItem struct {
	Value interface{}
	Count int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL