Documentation
¶
Overview ¶
Copyright (c) 2025 Nikita Kamenev Licensed under the MIT License. See LICENSE file in the project root for details.
Copyright (c) 2025 Nikita Kamenev Licensed under the MIT License. See LICENSE file in the project root for details.
Copyright (c) 2025 Nikita Kamenev Licensed under the MIT License. See LICENSE file in the project root for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GSA ¶
type GSA struct {
// contains filtered or unexported fields
}
GSA represents a generalized suffix array for multiple strings.
func (*GSA) LookupPrefix ¶
LookupPrefix finds prefix occurrences in the generalized suffix array, sorted by text position.
func (*GSA) LookupSuffix ¶
LookupSuffix finds suffix occurrences in the generalized suffix array, sorted by text position.
func (*GSA) LookupTextOrder ¶
LookupTextOrder finds prefix occurrences in the generalized suffix array, sorted by text position.
type SuffixArray ¶
type SuffixArray struct {
// contains filtered or unexported fields
}
SuffixArray holds a text and its suffix array.
func (*SuffixArray) Lookup ¶
func (sa *SuffixArray) Lookup(prefix []int32) []int32
Lookup finds suffixes starting with the given prefix.
func (*SuffixArray) LookupPrefix ¶
func (sa *SuffixArray) LookupPrefix(prefix []int32) int
LookupPrefix checks if the text starts with the given prefix. For an empty prefix, returns -1 as it precedes the first character. Returns 0 if matched, -2 otherwise.
func (*SuffixArray) LookupSuffix ¶
func (sa *SuffixArray) LookupSuffix(suffix []int32) int
LookupSuffix finds the exact suffix in the text. For an empty suffix, returns len(sa) as it occurs at the end of the string. Otherwise, returns the starting index or -1 if not found.
func (*SuffixArray) LookupTextOrder ¶
func (sa *SuffixArray) LookupTextOrder(prefix []int32) []int32
LookupTextOrder finds suffixes starting with the prefix, sorted by text position.