Public Group

#### Archived

This topic is now archived and is closed to further replies.

# what is a hash table?

This topic is 5424 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Can anyone explain what a hash table is, what it is used for, and how to use one? links are welcome. I couldn''t find any decent tutorial''s/explanations from (searching) google.com, and this site''s search engine is just giving me internal errors.

##### Share on other sites
No offense, but you''re blind.

"Sneftel is correct, if rather vulgar." --Flarelocke

##### Share on other sites
In simply words a hash table is an array, where each index of the array, you would have a linkedlist containing some sort of data (for example student record).

Picture:
index 0: [[("john",98908,3.4,"M"), ("ron",94908,3.5,"M")]]
index 1: [[]]
index 3: [("Tina",98568,3.3,"F")]
.
.
.
and so on.

How does hash table works?
One way:
You would initialize an array of certain length first. Then there is something called hashing number generated by the hashing algorithm, which determines where the data will go in the hash table. For example , in the above example, the hashing number would be determine by the student''s ID. The hashing number will be always be 0 <= H(x) < length(hastable). SO for example the the hashing number to Id 98908 came out to be 0, therefore you insert john''s record in the linked list of the first position in your hash table.

Now, there different way of doing a hashing problem. There are different hashing techniques. Sorry, i am in a hurry right now so i would say before u read on technical details, first read on the theory of hashing. Where?

1. 1
Rutin
26
2. 2
3. 3
4. 4
5. 5

• 11
• 10
• 13
• 20
• 14
• ### Forum Statistics

• Total Topics
632950
• Total Posts
3009382
• ### Who's Online (See full list)

There are no registered users currently online

×