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

Function computeShiftMap

strings/horspool/horspool.go:51–60  ·  view source on GitHub ↗
(t, p []rune)

Source from the content-addressed store, hash-verified

49}
50
51func computeShiftMap(t, p []rune) (res map[rune]int) {
52 res = make(map[rune]int)
53 for _, tCode := range t {
54 res[tCode] = len(p)
55 }
56 for i, pCode := range p {
57 res[pCode] = len(p) - i
58 }
59 return res
60}

Callers 1

horspoolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected