Documentation ¶
Overview ¶
Package rabinkarp implements Rabin-Karp* string search algorithm.
Provides searching multiple patterns with an average O(n+m) time complexity (where n is the length of text and m is the combined length of pattern strings).
* https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm
Example ¶
package main import ( "fmt" "github.com/glkz/rabinkarp" ) func main() { txt := "a man a plan a canal panama" patterns := []string{"man", "boat", "plan", "ana", "banana"} matches := rabinkarp.Search(txt, patterns) fmt.Println(matches) }
Output: [man plan ana]
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.