How the Double Hash Function Works in C++?
<p>I was reading about HashTable and found a good source to easily understand <a href="http://faculty.cs.niu.edu/~freedman/340/340notes/340hash.htm" rel="nofollow noreferrer">Here.</a></p>

<p>But I got confused on double hashing function. Here is the detail of double hashing function.</p>

<blockquote>
  <p>Double hashing uses the idea of applying a second hash function to the
  key when a collision occurs. The result of the second hash function
  will be the number of positions form the point of collision to insert.</p>
  
  <p>There are a couple of requirements for the second function:</p>

<pre><code>it must never evaluate to 0
must make sure that all cells can be probed
</code></pre>
  
  <p>A popular second hash function is: Hash2(key) = R - ( key % R ) where
  R is a prime number that is smaller than the size of the table.</p>
</blockquote>

<p>and Here is the Image of double hash function.</p>

<p><a href="https://i.stack.imgur.com/rvRd1.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rvRd1.gif" alt="enter image description here"></a></p>

<p>Now confusion starts. as they are saying in image. 49 should be on <code>7</code> positions from <code>[9]</code> index. then the actual position will be <code>[6]</code> then why they placed 49 at <code>[0]</code> index? and same for other remaining integer.</p>

<p>And what will happen when there will be no empty index?</p>