> what is a hash value?

Some clever person back in the 1950s realized that computers were
better at numbers than names. So they came up with some gimmicks to
convert names to numbers. It was probably something fancier than "a=1,
b=2, etc. Now let's add up all the letters of the person's name to
make a unique number for that person", but that at least gives you an
idea of what's going on.

Instead of hunting through a list of names for John Doe to find his
phone number, just convert John Doe to 2453 or whatever, then jump
directly to the 2453rd slot in an array, and stow/find his phone
number there.

You can probably immediately see a drawback. Two people's names might
add up to the same number. There are two fixes. Come up with a better
names-to-numbers gimmick, or come up with a gimmick like mini-lists at
each number.

Alan

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to