MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / ArrayUnion

Function ArrayUnion

strings/ahocorasick/shared.go:86–95  ·  view source on GitHub ↗

ArrayUnion Concats two arrays of int's into one.

(to, from []int)

Source from the content-addressed store, hash-verified

84
85// ArrayUnion Concats two arrays of int's into one.
86func ArrayUnion(to, from []int) (concat []int) {
87 concat = to
88 for i := range from {
89 if !Contains(concat, from[i]) {
90 concat = IntArrayCapUp(concat)
91 concat[len(concat)-1] = from[i]
92 }
93 }
94 return concat
95}
96
97// GetParent Function that finds the first previous state of a state and returns it.
98// Used for trie where there is only one parent.

Callers 2

BuildAcFunction · 0.85
BuildExtendedAcFunction · 0.85

Calls 2

ContainsFunction · 0.85
IntArrayCapUpFunction · 0.85

Tested by

no test coverage detected