title: Hashing Function/Code
body: <p>so I'm just learning (or trying to) a bit about hashing. I'm attempting to make a hashing function, however I'm confused where I save the data to. I'm trying to calculate the number of collisions and print that out. I have made 3 different files, one with 10,000 words, 20,000 words and 30,000 words. Each word is just 10 random numbers/letters.</p>
  
  <pre><code>long hash(char* s]){
      long h;
      for(int i = 0; i &lt; 10; i++){
        h = h + (int)s[i];
      }
       //A lot of examples then mod h by the table size
       //I'm a bit confused what this table is... Is it an array of
       //10,000 (or however many words)?
  
      //h % TABLE_SIZE
      return h
    }
  
    int main (int argc, char* argv[]){
      fstream input(argv[1]);
      char* nextWord;
      while(!input.eof()){
        input &gt;&gt; nextWord;
        hash(nextWord);
      }
    }
  </code></pre>
  
  <p>So that's what I currently have, but I can't figure out what the table is exactly, as I said in the comments above... Is it a predefined array in my main with the number of words in it? For example, if I have a file of 10 words, do I make an array a of size 10 in my main? Then if/when I return h, lets say the order goes: 3, 7, 2, 3</p>
  
  <p>The 4th word is a collision, correct? When that happens, I add 1 to collision and then add 1 to then check if slot 4 is also full?</p>
  
  <p>Thanks for the help!</p>