A computer-implemented method for placing transitions, each from a source state to a destination state, of an automaton into a hash table to generate a perfect hash table, the computer-implemented method comprising:
- a) dividing the transitions into multiple independent sets according to their respective source states;
- b) ordering the sets of transitions based on the number of transitions belonging to the set, thereby defining an order of the sets from largest to smallest;
- and
- c) constructing a perfect hash table by, for each of the sets of transitions, in the order from largest to smallest, hashing the transitions of the set into the hashing table to generate a perfect hashing table.