Hash+Tables

-Hash Tables are just like arrays but instead of a slot it is called a bin. In these bins data can be stored, deleted or found. Hash tables sacrifice memory for the sake of speed - it is not the most memory efficient means of storing data, but it provides very fast lookup times.

-There are a number of things that a hashing function needs to possess in order that the hash table be used effectively: 1. Data should be dispersed as randomly as possible across the hash table to minimise the chances of a collision. For example, a good hashing function would place the letter ``b fairly far from the letter ``a. 2. The hashing function should execute in a reasonable period

A program's effectiveness is essentially based on the speed with which is processes information, and the amount of memory it takes up. Because many computers today are built to have amazing amounts of memory, making fast programs that use up fair amounts of memory has become more productive than making slower programs that take up little memory.

The whole point of a hash table is to make an "array" of data with a set of items that can instantly be accessed with just one step. In order for this to work properly, each possible item (string, int, etc) must have its own numerical value. The simplest way of doing this would be to assign each of the letters of the alphabet a number 1 through 26. The next step is to create an algorythm that will link that number to a given value in your "array". you could use an algorythm to find the average of the letters in a specific word, i.e Meermans = (13 + 5 + 5 + 18 + 1 + 14 + 19) / 8 = 9.375 (rounded down, would be equal to 9). This algorythm would put "Meermans" in the 9th spot (which would be slot 8) of a 26 slot "array". By using hash tables, each word has a specific value, and can essentially have only 1 value, so the computer has only 1 spot to check.

The main downfall of hash tables, is that two words can have the same value. i.e. AB == BA. If AB and BA were to be in the same hash table, they would be assigned to the same spot if they algorythm was as simple as the one above. The easiest way to prevent this would be to assign BA to the slot immediately after AB, assuming that AB was entered into the data first.