6

Example: Suppose $H:${$1,...,n$} $\rightarrow ${$1,..,n$} be a uniform hash function. for input $x$, $z$ is equal to number of trailing zero in the right side of $H(x)$. for $0 \leq c \leq 1$ what is the order of probability $ z \geq c \log_2 n$? $C$ is constant here.

Answer: $O(1/n^c)$

How this this is can be achieved?

Update:

The Logarithm base is $2$ not $10$.

  • 1
    Suppose $n=1,000$, how many elements in ${1,\ldots,n}$ end on a zero? On 2 zeros? And on 3 zeros? What if $n=1,000,000$ and you look at $1,2,\ldots,6$ zeros? – LinAlg Nov 28 '20 at 02:58
  • my comment was not related to 11-1 and does not involve a factor 2 – LinAlg Nov 28 '20 at 17:01
  • $100$ elements in ${1,\ldots,1000}$ end on a zero, $10$ elements end on two zeros, $1$ element ends on three zeros. Here, $\log n = 3$, and indeed $(1/1000)^c$ is proportional to $100, 10, 1$ for $c=1/3$, $c=2/3$ and $c=1$, respectively. It is not continuous in $c$, but take a larger $n$ to make it smoother. – LinAlg Nov 28 '20 at 19:54

1 Answers1

5

Since the hash function is uniform, to find $P(z \geq c \log n)$ we can simply count the number of elements in $S = \{1,\ldots,n\}$ that satisfy $z \geq c \log n$.

Take $n=2^p$ for some $p\in\mathbb{N}$. Then $n/2$ elements in $S$ end on one zero, $n/4$ elements end on two zeros, etc. So, $P(z \geq c \log n) = (n/2)/n = 1/2$ for $c\log n =1$, $1/4$ for $c\log n=2$, $1/8$ for $c\log n=3$, etc.

So $P(Z \geq c \log n) = (1/2)^{c \log n} = (1/2^{\log n})^c = (1/n)^c$.

LinAlg
  • 20,093
  • what is the intuitive idea to use P(z>= CP) instead of z >= C log n? – LoveMathContest Jan 09 '21 at 15:09
  • so here what is the base of logarithm? – LoveMathContest Jan 09 '21 at 20:41
  • I means if base of logarithm be $2$ we should change all of $10$ to $2$ am I right? – LoveMathContest Jan 09 '21 at 20:42
  • @LoveMathContest I used the argument that exactly $n/10$ elements in $S$ end on one zero, which only holds true if $n$ is a power of 10. The base of the logarithm has to match the representation, so can you can use log2, but only for binary representation. If you use log2 with decimal representation, you get: $P(Z \geq c \log_2 n) = P(Z \geq (c / \log 2) \log n) = (1/n)^{c / \log 2}$ which is not $O(1/n^c)$. – LinAlg Jan 09 '21 at 21:34
  • @LoveMathContest you just replace $\log$ with $\log_2$, $10$ with $2$, $100$ with $4$ and $1000$ with $8$. – LinAlg Jan 09 '21 at 21:44
  • sure, so your answer works in this case too. but you mentioned in your comment not ! – LoveMathContest Jan 09 '21 at 21:46
  • please clean comments. – Mio Unio Jan 31 '21 at 23:15