View on GitHub

reading-notes

Hashtables

What is a Hashtable?

Hashtables are a data structure that utilize key value pairs. This means every Node or Bucket has both a key, and a value.

Internal Methods

The Find takes in a key, gets the Hash, and goes to the index location specified. Once at the index location is found in the array, it is then the responsibility of the algorithm the iterate through the bucket and see if the key exists and return the value.

The Contains method will accept a key, and return a bool on if that key exists inside the hashtable. The best way to do this is to have the contains call the GetHash and check the hashtable if the key exists in the table given the index returned.

The GetHash will accept a key as a string, conduct the hash, and then return the index of the array where the key/value should be placed.


refrences :