But one thing you already know, is that you don't want SHAS or some other theocrat.
But how to choose???
Easy! Just ask the GOD OF LUCK!
The GOD OF LUCK |
P.S. For the GEEKS out there:
GIVEN: a linked-list (or an iterator, if you like) containing anywhere between 1 and an UNLIMITED amount of items (and you don't know how many off hand).
THE GOAL: choose one item from the list randomly (each having an equal chance of being picked)
CONSTRAINT: you need to do it as fast as possible! (meaning, O(N), loser).
YOU SAY: "But kind sir, this is impossible!"
I SAY: "Nothing is impossible but impossible itself! Look at the Javascript in this post as PROOF"
No comments:
Post a Comment