Skip to content

Rabin-Karp algorithm perfomance #992

@alisher-matkurbanov

Description

@alisher-matkurbanov

Your Rabin-Karp algorithm uses python default hash function which is not using rolling hash property that allows to compute hash of next string effectively for constant time. Because of this property RK-algo works for O(n) in average case (when collisions for hash of part of s and hash for pattern don't happen so often). It would be better to improve this implementation.

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