Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error in "Compressing a string" section in "Prefix function. Knuth–Morris–Pratt algorithm" #1414

Open
@ohwphil

Description

@ohwphil

I think "But then the string consists of only one character repeated over and over, hence we can compress it to a string of size  $1$ ..." is false. Shouldn't it be written: "But then the string consists of $gcd(p, k)$ characters repeated over and over, hence we can compress it to a string of size $gcd(p, k)$, and since it divides $p$ it also divides $n$."

Example: k = 4, n = 12, p = 6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions