Skip to content
Implementation of the multiset data structure
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.idea
.gitignore
.golangci.yml
.travis.yml
LICENSE.md
README.md
go.mod
multiset.go
multiset_test.go

README.md

Multiset

CircleCI branch License GitHub tag (latest SemVer)

Multiset is a threadsafe abstract data structure library for representing collection of distinct values, without any particular order. Unlike a set, multiset allows multiple instances for each of its elements.

Example

package main

import (
    "fmt"
    
    "github.com/trivigy/multiset"
)

func main() {
    m := multiset.New("b", "b", "c", "d")
    fmt.Println(m.Contains("b", "c", "d"))
    
    m1 := multiset.New()
    m1.AddCount("a", 3)
    m1.AddCount("b", 2)
    fmt.Println(m1.DistinctElements())
}
You can’t perform that action at this time.