MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / update_hash

Function update_hash

src/string/rabin_karp.rs:70–83  ·  view source on GitHub ↗

Updates the rolling hash when shifting the search window. # Arguments `s` - The full text where the search is performed. `old_idx` - The index of the character that is leaving the window. `new_idx` - The index of the new character entering the window. `old_hash` - The hash of the previous substring. `radix_pow` - The precomputed value of RADIX^(n-1) % MOD. # Returns The updated hash for the new

(
    s: &str,
    old_idx: usize,
    new_idx: usize,
    old_hash: usize,
    radix_pow: usize,
)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

rabin_karpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected