Can you explain this improvement to this frequency distribution algorithm?
You don't really choose $\epsilon$. Rather, you (virtually) add $k-\epsilon$ and $k+\epsilon$ to your linear order at the correct spots, a feat which you accomplish by modifying your comparison function. Binary search requires you to answer queries of the form $x &lt; y$. When looking for $k-\epsilon$ (or $k+\epsilon$), either $x$ or $y$ could be $k-\epsilon$ (or $k+\epsilon$), and so we have to extend the definition of the comparison function, as follows:
$$
k-\epsilon &lt; y \text{ if } k \leq y \\
x &lt; k-\epsilon \text{ if } x &lt; k \\
k+\epsilon &lt; y \text{ if } k &lt; y \\
x &lt; k+\epsilon \text{ if } x \leq k
$$
The comparison functions on the right are the original ones (with $x \leq y$ being shorthand for $x &lt; y$ or $x = y$), and the ones on the left are the new ones.