Thread: Hash collision Probability

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    3

    Hash collision Probability

    Hi all

    I would like to know from where this equation came:
    Hash collision Probability = 2^-n = 1/2^n
    Please help me!
    Last edited by Salem; 08-02-2012 at 07:03 AM. Reason: font abuse

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    This thread was split from trouble with hash function implementing.

    Quote Originally Posted by Mustafa_Ayoob
    I would like to know from where this equation came:
    Hash collision Probability = 2^-n = 1/2^n
    You probably should provide some context, unless you are really talking about why the equation is so, in which case it is a matter of mathematics.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Aug 2012
    Posts
    3
    no am sorry , but i want to know from where the above equation came? it's used to calculate the collision if happend in hash function, am not talking about programming in c++..
    Last edited by Salem; 08-02-2012 at 07:03 AM. Reason: more font abuse

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Mustafa_Ayoob
    i want to know from where the above equation came? it's used to calculate the collision if happend in hash function
    You should be the one telling us that: where did you encounter it, and what is the hash function?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Aug 2012
    Posts
    3
    ok i find the solution
    it is basic propability calculation cames form Statistic.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hash function to hash key into geographic coordinate
    By dominic_tran201 in forum C++ Programming
    Replies: 2
    Last Post: 02-11-2011, 10:03 AM
  2. Hash tables / hash maps
    By dlwlsdn in forum C Programming
    Replies: 3
    Last Post: 05-26-2010, 11:45 AM
  3. Replies: 12
    Last Post: 04-09-2010, 02:42 PM
  4. probability
    By sycamorex in forum Windows Programming
    Replies: 0
    Last Post: 11-25-2006, 06:10 AM
  5. probability
    By billytsc in forum C++ Programming
    Replies: 0
    Last Post: 10-18-2001, 02:22 PM