3 ms·
The first sentence of the article explains what a perfect hash function is : "A perfect hash function is one that is collision-free.". Essentially, a perfect ha
by porpoisely 8y ago
The first sentence of the article explains what a perfect hash function is : "A perfect hash function is one that is collision-free.". Essentially, a perfect hash function is one where no two domain elements map to the same range element.
If you want to explore it further, you can search for injective functions and one-to-one mapping.
An example of a function that produces collisions is the ABS function.
ABS( 2 ) = 2.
ABS( -2 ) = 2.
Two domain elements ( 2 and -2 ) map to the same range element ( 2 ).
- xorand 8y agoThe identity function is collision free. It's the fastest one.