Hash Tables
Essay by 24 • December 1, 2010 • 582 Words (3 Pages) • 1,160 Views
Mark Radice
SD290
Hash Tables
The term Hash Search refers to a search, in which they key, through an algorithmic function, determines the location of the data. In essence, the goal is to find the data with only one search. The hash search runs very quickly because of this. It's Big O, or orders of power, approaches O(1) and will never exceed O(n). To accomplish this search, a program is written in which the key is passed into the hash function, which in turn, finds the address of the data needed. To start with, the function will take in a string of characters. It will then convert those characters to an ASCII value and add them together giving it a yield or position.
The first step is simply inputting a string of characters. The program then is designed to convert those characters to an ASCII value. Those values are then added together to give it an initial index value inside your set table. The function will continue to run as long as data needs to be stored. It will continue to cycle through placing data into the proper locations based upon your math formula. This sounds like it would be a perfect table of data that is easily searchable except there is a bit of a problem.
The problem comes in when two pieces of data produce the same yield. The table will try to store this into the same place as the other data with that index number. These data that share the same index are referred to as synonyms. When the function attempts to place multiple pieces of data into the same index position, the computer encounters what is called a collision. The address, or index, produced by the hashing algorithm is known as the home address. The memory that contains all of the home addresses is known as the prime area. When two keys collide at a home address, we must resolve the collision by placing one of
...
...