Skip to content

Implementation of the multiset data structure

License

Notifications You must be signed in to change notification settings

trivigy/multiset

Repository files navigation

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())
}

About

Implementation of the multiset data structure

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages