Skip to main content

So I'm watching an Algorithms course in Coursera, and we are currently discussing hash tables. He's talking about the importance of a good hash function, and about how an ideal hash function would be a "super clever hash function guaranteed to spread every data set evenly".

Then, he explains that the problem is that such a hash function does not exist (and that for every hash function there is a pathological data set), and that the reason for this is as follows:

fixFix a hash function h: U -> {0, 1, 2, ..$h: U \to \{0, 1, 2, ..., n-1\}$., n-1} => a laBy the Pigeonhole Principle, there exists a bucket i$i$ such that at least |U|/n$|U|/n$ elements of U$U$ hash to i$i$ under h$h$. => if If a data set draws only from these, everything collides.

The bolded part is what's confusing me. Why does there exist a bucket i$i$ such that at least |U|/n$|U|/n$ elements of U$U$ hash to i$i$ under h$h$? I can't really visualize what he means.

So I'm watching an Algorithms course in Coursera, and we are currently discussing hash tables. He's talking about the importance of a good hash function, and about how an ideal hash function would be a "super clever hash function guaranteed to spread every data set evenly".

Then he explains that the problem is that such a hash function does not exist (and that for every hash function there is a pathological data set), and that the reason for this is as follows:

fix a hash function h: U -> {0, 1, 2, ..., n-1} => a la Pigeonhole Principle, there exists a bucket i such that at least |U|/n elements of U hash to i under h. => if data set draws only from these, everything collides.

The bolded part is what's confusing me. Why does there exist a bucket i such that at least |U|/n elements of U hash to i under h? I can't really visualize what he means

So I'm watching an Algorithms course in Coursera, and we are currently discussing hash tables. He's talking about the importance of a good hash function, and about how an ideal hash function would be a "super clever hash function guaranteed to spread every data set evenly".

Then, he explains that the problem is that such a hash function does not exist (and that for every hash function there is a pathological data set), and that the reason for this is as follows:

Fix a hash function $h: U \to \{0, 1, 2, ..., n-1\}$. By the Pigeonhole Principle, there exists a bucket $i$ such that at least $|U|/n$ elements of $U$ hash to $i$ under $h$. If a data set draws only from these, everything collides.

The bolded part is what's confusing me. Why does there exist a bucket $i$ such that at least $|U|/n$ elements of $U$ hash to $i$ under $h$? I can't really visualize what he means.

Source Link
FrostyStraw
  • 393
  • 1
  • 2
  • 11

Hash functions and pathological data sets

So I'm watching an Algorithms course in Coursera, and we are currently discussing hash tables. He's talking about the importance of a good hash function, and about how an ideal hash function would be a "super clever hash function guaranteed to spread every data set evenly".

Then he explains that the problem is that such a hash function does not exist (and that for every hash function there is a pathological data set), and that the reason for this is as follows:

fix a hash function h: U -> {0, 1, 2, ..., n-1} => a la Pigeonhole Principle, there exists a bucket i such that at least |U|/n elements of U hash to i under h. => if data set draws only from these, everything collides.

The bolded part is what's confusing me. Why does there exist a bucket i such that at least |U|/n elements of U hash to i under h? I can't really visualize what he means