bytealg

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const PrimeRK = 16777619

PrimeRK is the prime base used in Rabin-Karp algorithm.

Variables

This section is empty.

Functions

func Count

func Count(s string, c byte) (n int)

func CountSlice

func CountSlice(b []byte, c byte) (n int)

func HashStr

func HashStr(sep string) (uint32, uint32)

HashStr returns the hash and the appropriate multiplicative factor for use in Rabin-Karp algorithm.

func HashStrBytes

func HashStrBytes(sep []byte) (uint32, uint32)

HashStrBytes returns the hash and the appropriate multiplicative factor for use in Rabin-Karp algorithm.

func HashStrRev

func HashStrRev(sep string) (uint32, uint32)

HashStrRev returns the hash of the reverse of sep and the appropriate multiplicative factor for use in Rabin-Karp algorithm.

func HashStrRevBytes

func HashStrRevBytes(sep []byte) (uint32, uint32)

HashStrRevBytes returns the hash of the reverse of sep and the appropriate multiplicative factor for use in Rabin-Karp algorithm.

func Index

func Index(s, substr string) int

func IndexByte

func IndexByte(s string, c byte) int

func IndexRabinKarp

func IndexRabinKarp(s, substr string) int

IndexRabinKarp uses the Rabin-Karp search algorithm to return the index of the first occurrence of substr in s, or -1 if not present.

func IndexRabinKarpBytes

func IndexRabinKarpBytes(s, sep []byte) int

IndexRabinKarpBytes uses the Rabin-Karp search algorithm to return the index of the first occurrence of substr in s, or -1 if not present.

func IndexSlice

func IndexSlice(s, sep []byte) int

func IndexSliceByte

func IndexSliceByte(b []byte, c byte) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL