Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Security > Re: Simple coll...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 1774 of 1825
Post > Topic >>

Re: Simple collision question

by Roedy Green <see_website@[EMAIL PROTECTED] > Jun 2, 2008 at 09:47 AM

On Thu, 29 May 2008 13:00:58 -0700 (PDT), puggid@[EMAIL PROTECTED]
 wrote,
quoted or indirectly quoted someone who said :

>I was wondering if someone tell me how I go about calculating
>collision rates for a "key" that is 2 characters (lowercase alpha
>only) long?

Think about it this way.

To have no collisions with a perfect hash.

for 2 keys and N slots, my odds are 1- (N-1)/N since all slots but 1
are good.

when I add another key, the odds that one will be good too is

1- (N-2)/N.

The odds of all 3 keys going to different slots are:

[1- (N-1)/N] * [1- (N-2)/N]

You should see the pattern.

You can compute this iteratively or factor it to use factorials which
just mask the iteration.
-- 

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 




 3 Posts in Topic:
Simple collision question
puggid@[EMAIL PROTECTED]   2008-05-29 13:00:58 
Re: Simple collision question
Tarin Gamberini <o968z  2008-05-30 22:44:21 
Re: Simple collision question
Roedy Green <see_websi  2008-06-02 09:47:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 6 10:50:26 CDT 2008.