QUOTE(jadedjeanne @ 5 Jan, 2008 - 12:53 PM)

Hi. I'm trying to make a report on hash tables. I've been reading stuff here and other stuff on the internet and it all seems to just fly over my head. I'm just trying to make sure that I understand the concept properly.
From what I'm getting so far, A hash is like a method of organizing data using a key generated from the data itself. The point of a hash is so that it'll be easy to look for the data when you need it. It that right?
An example that I can think of is like a student list in a school. When you enroll they assign you a student number and all of your information is stored next to that or into that container (name, age, course, etc). So student numbers are the hash keys in effect.
If the stuff above is correct then there are a few things that I'm not so sure about:
1. Is it still considered a hash if I assign the key myself? Like if I were to make a sample program for the report and make a list of 10 students and use 0001 to 0010 as the hash keys, would that still be a hash? Or do I have to make a function that comes up with keys for it to be a valid example?
2. Is there such a thing as multiple hashes? Like the way the first few digits of a student number have something to do with the year that you enrolled (e.g. 2007-0112)?
Is my understanding of the concept of hashing waaay off?
Would really appreciate any help at all. Thanks.
I had very similar problems understanding hashing when I was studying for my Security + certification. So for your first question you dont technically need to have a function that creates the hash keys for you. The reason you do normally have a function (or mathematical equation) is:
1. Computers are much faster and better hash keys
2. If you have a lot of data you want to work with having a simple equation will speed up the process of creating and assigning keys.
The way to look at it is, hashing is more of a method that is proven to work. Its like making cereal for break fest. Your parents tell you to put in your frosted flakes and then put in the milk. But you can still put in the milk first and then put in the frosted flakes. Its just a method of making your break fest and dose not mean you have to do it that exact way.
For your second question hashing can be as complex as you would like it to be. Now due to the length of a hash you might need to have two hashes to first represent the person year and then their students number. It really all depends on a couple factors of creating your hash.
The above link it a very good resource and trust me its not the more simple thing to understand. I would start by working with small amount of data and create simple applications. Start on the smaller scale to get the concept and then work your way up.
This post has been edited by lockdown: 5 Jan, 2008 - 12:40 PM