Documentation
¶
Overview ¶
Package rabinkarp provides the Rabin-Karp string pattern matching algorithm.
Example ¶
package main
import (
"fmt"
"rabinkarp"
"sort"
)
func main() {
pattern := "bro"
inputs := []string{"slowbro", "browser", "bob", "st", "bebrobaum"}
matcher := rabinkarp.Make(rabinkarp.NaiveHasher)
matches := matcher.MatchAll(pattern, inputs)
sort.Sort(matches)
fmt.Println(matches)
}
Output: [{0 browser} {2 bebrobaum} {4 slowbro}]
Index ¶
Examples ¶
Constants ¶
View Source
const (
NaiveHasher = naiveHasher(0)
)
Variables ¶
View Source
var DefaultMatcher = Make(NaiveHasher)
DefaultMatcher provides a instance of RabinKarp with the naive hasher implementation.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.