You will need 5 million different hash tables.
Which meanns that if you are lokking for a given value, say -4, across all of your arrays you will have to consult each hash to see if -4 is in the array and which element it is.
This will result in some performance gain.
I'm assuming that the position of the element and the value in the in the array both have meaning.
It sounds like the data design needs to be rethought -- more than that a hash table will fix your problems. For example, a database can do
highly optimized lookups, like count the number of element #3 that equals 20.
I dunno, don't know enough to about your problem to help, really.
Narue has a site
www.eternallyconfuzzled.com
that has a good explanation of hashing algorithms.
UNIX systems usually come with hcreate, hsearch as an implementation of using Knuth's
original hashing work.
I personally think you've got a data design problem. Possibly you should have put in associative arrays upfront as part of the design.
Hashing added after the fact may only help a little. Depending on how far down the call tree your lookups are embedded in your code.