intersect

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 0 Imported by: 0

README

Build Status Go Report Card

go-intersect

Simple array intersection using hash maps.

Installation

go get -u github.com/hasansino/go-intersect

Usage

var (
    a = []int64{1,2,3}
    b = []int64{3,5,6}
)

c := intersect.Int64(a, b)

Two methods are available: String() and Int64()

Performance

goos: linux
goarch: amd64
pkg: github.com/hasansino/go-intersect
BenchmarkInt64-8    	 3070972	       370 ns/op	      64 B/op	       1 allocs/op
BenchmarkString-8   	  829771	      1382 ns/op	     451 B/op	       2 allocs/op

Documentation

Overview

Package intersect provides a simple way to find intersection between two int64 or string arrays.

Simple usage:

var (
    a = []int64{1,2,3}
    b = []int64{3,5,6}
)
c := intersect.Int64(a, b)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int64

func Int64(a, b []int64) []int64

Int64 finds intersection between two []int64 arrays Complexity O(n+m)

func String

func String(a, b []string) []string

Int64 finds intersection between two []string arrays Complexity O(n+m)

Types

This section is empty.

Jump to

Keyboard shortcuts

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