Re: Looking up a person's name, given personnel number
- Posted by mattlewis (admin) Jun 07, 2012
- 1130 views
Swifty said...
I have a file where each line contains a personnel number, and a name. In this context, a "number" can contain upper-case letters as well. So, one line might be:
ABC123 Steve Swift
How should I store this data such that I can deduce the name, if all I know is that Persnum='ABC123' ?
I'm not asking for the mechanism whereby I read the file, presumably that is simple, it is the actual data storage in memory that interests me. I think that I'm asking for a "hash" mechanism, but I was off sick the day they taught about hashes in my schooldays "Computer Science" class.
Take a look at the standard library implementation of maps. It uses euphoria's built in hash functionality.
Matt