3 ms·
Easy solution: 1. Look up the first 60 questions on StackOverflow. That amounts to 5 hours you would've spent on just the first one. 2. If you still have more
by wfunction 13y ago
Easy solution:
1. Look up the first 60 questions on StackOverflow. That amounts to 5 hours you would've spent on just the first one.
2. If you still have more questions, spend another 5 hours learning the ins and outs of the darn thing.
Problem solved: now you're not sacrificing latency for throughput.
- zaptheimpaler 13y agoThis is exactly the rent-or-buy problem! http://en.wikipedia.org/wiki/Ski_rental_problem http://en.wikipedia.org/wiki/Ski_rental_problem You just described the best deterministic algorithm, but it turns out there are even better randomized algorithms, where you "flip a coin" when deciding to look up StackOverflow or keep learning (of course, that may or may not be practical :p).
- TeMPOraL 13y agoThanks for the link! Hmm... given that you stated that the best randomized algorithms we have beat our best deterministic ones, isn't there a place for even better deterministic algorithm?
- zaptheimpaler 13y agoNope. Thats really the point - if we find the best deterministic algorithm, it means we have found the one with the best deterministic running time. By loosening our criteria of running time to expected running time and allowing randomness, we can sometimes do better than deterministic algorithms.
- TeMPOraL 13y agoIt doesn't square well with my intuition - if we understand how allowing randomness improves expected running time, then surely we must be able to create a deterministic algorithm that is at least as good as the randomized one. Am I missing some critical piece of understanding here?
- ethbro 13y agoI'd expect that it's simply that the additional constraints implied by requiring deterministic behavior precludes certain optimizations that can lead to improved running time. Iow, if you can never do X, then you cannot write any algorithm that may do X.
- zaptheimpaler 13y agoWell keep in mind that the inputs to the algorithm can vary. Randomization can help avoid a bad input from throwing your algorithm off. A simple example of how randomization helps is quicksort: if we pick the pivot to always be the first element, then any sorted array will cause worst-case running time. But by randomizing the pivot, we can do well (in expectation) for any input.
- jasallen 13y agoI think flip a coin covers what I do :-) Sometimes I really wanna dig in, sometimes I just. need. to. finish.