Minimal perfect hashing functions have wide application. The unappealing aspect of the solution given here is that the functions h0,h1,h2 and g that are the basis for the hashing function F, i.e.,
F(w) = (h0(w) + g:.M- C2 °h1(w) + g2 °h2(w)) mod n
have to be guessed at. The author suggests (arbitrarily?):
:Ch:A:0I0(:Cw:A)(length(w) + &Sgr; ord(w[i]), i- = 1 to length (w) by 3))
h1(w) = (&Sgr; ord(w[i]), i := 1 to length (w) by 2) mod r
h2(w) = (&Sgr; ord(w[i]), i := 2 to length (w) by 2) mod r + r
where r = smallest power of 2 greater than card (w)/3. (The function g is found by the algorithm; one with appropriate properties always exists.) Sager says that the above choices worked well in most cases (it has been used successfully on sets of cardinality up to 512). An example of when it did not work is for the 40 predeclared identifiers of PASCAL. However, since the function choices have few restrictions, another set of choices did work. This current work is a direct outgrowth of Cichelli’s algorithm [1].