Categorygithub.com/juliangruber/go-intersect
modulepackage
1.1.0
Repository: https://github.com/juliangruber/go-intersect.git
Documentation: pkg.go.dev

# README

go-intersect

Find the intersection of two iterable values.

This library provides multiple implementations which each have their strong and weak points.

Read the docs.

Build Status

Installation

$ go get github.com/juliangruber/go-intersect

Example

import "github.com/juliangruber/go-intersect"
import "fmt"

func main() {
  a := []int{1, 2, 3}
  b := []int{2, 3, 4}
  fmt.Println(intersect.Simple(a, b))
}

# Functions

Hash has complexity: O(n * x) where x is a factor of hash function efficiency (between 1 and 2).
Simple has complexity: O(n^2).
Sorted has complexity: O(n * log(n)), a needs to be sorted.