4 ms·
Actually, I was wrong about O(log(N)), the lookup time is O(1), you just have to put all known hashes in a map structure, or even better, a rainbow hash. So yo
by rorrr 14y ago
Actually, I was wrong about O(log(N)), the lookup time is O(1), you just have to put all known hashes in a map structure, or even better, a rainbow hash.
So your technique only adds some constant lookup time.
Instead of
if (hash == target_hash) ...
you will do
if (map[hash]) ....
Sorry, I think you are wrong.
- xaway12345 14y agoeh, this is amortized O(1) and you are almost guaranteed slow lookups for a large number of requests. don't confuse true O(1) with amortized ;)