
Functional Pearl 1 – The Min Missing Natural Number - lelf
http://typeocaml.com/2015/02/02/functional-pearl-no-1-the-min-free-nature/
======
xyzzyz
The "responsive design" of this website uses two columns for web content when
viewport is wide enough. This is supremely bad UX. Not only it is totally
unexpected, as nobody on the web does it, it is also quite frustrating, as it
forces you to scroll up to read second column.

I really hate it when people do that. This looks good in print, but the print
is different medium with different constraints. Web is not print.

------
rnovak

        >But we can skip out ideally half of the numbers.
    

_ideally_ , but in the worst case it's O(n * (n - 1)), or O (n^2)

if your first X is the max, and your second choice is X-1, and so forth (in
the worst case), then you're not operating in O(n), but n^2

~~~
jacksontale
Yeah, you are right, I should have mentioned that.

~~~
marvy
But there's an easy fix: don't pick numbers from the given sequence, instead
use binary search on [0,n]. Then you're guaranteed only log n iterations.

~~~
jacksontale
Hi, I was using pure functional programming style, so list only.

------
marvy
Another idea is to just stuff the input into a hash table and then say: is 0
there? is 1 there? ... is n-1 there?

