title: How to write a perfect hash function for 36 strings?
body: <p>Using the numbers 0-5 I need to write a perfect has function for 36 Student ID Strings with six characters and 3 integers (e.g. BYPLOK120).</p>
  <p><strong>The hash function looks something like as follows:</strong></p>
  <pre><code>String [] studentID = ...
  </code></pre>
  <p>is 36 unique Strings in the format (xxx/yyy/zzz) where x and y are three letters from the students last and first names, respectively. z are 3 random numbers.</p>
  <pre><code>int hashTableSize = 37;`
  
  int [] hashValue = new int[9];`
  
  int [] weights = {1,0,5,4,3,2,5,1,2};  
  </code></pre>
  <p>Weights is 9 numbers between 0-5. THIS IS THE PART I NEED TO FIGURE OUT - there are about 2 million combinations (5^9) and less than 10 will give you a perfect hash function.</p>
  <pre><code>for (int i = 0; i &lt; hashTableSize; i++)
     for (int j = 0; j &lt; studentID[I].length; j++)
         hashVal[i] += ( studentID[i].charAt(j) * weight[j] ) % hashTableSize;
  </code></pre>
  <p><strong>I need the hash value of each string in the array to be unique (i.e. there are no collisions when inserting)</strong></p>
  <p>I had duplicate hash values as I could not find the unique array of weight integers.</p>