<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Rolling hash - Page 4 - Wikipedia">
<p>
<a accesskey="1" href="page.php?w=Rolling_hash&amp;p=3">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Rolling_hash&amp;p=5">3.Next</a>
</p>
<p>The <a href="page.php?w=Rabin-Karp_string_search_algorithm">Rabin-Karp string search algorithm</a> is often explained using a rolling hash function that only uses multiplications and additions:<br/>
:,where  is a constant, and  are the input characters (but this function is not a <a href="page.php?w=Rabin_fingerprint">Rabin fingerprint</a>, see below).</p>

<p>In order to avoid manipulating huge  values, all math is done <a href="page.php?w=modular_arithmetic">modulo</a> . The choice of  and  is critical to get good hashing; in particular, the</p><p>
<a accesskey="1" href="page.php?w=Rolling_hash&amp;p=3">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Rolling_hash&amp;p=5">3.Next</a>
</p>

<do type="prev" label="Search">
        <go href="search.wml"/>
</do>

</card>
</wml>
