I wonder what the worst factors of unnecessary overhead are. There's plenty of examples of being O(n^2) when you could have been O(n) (surprisingly easy to do). And of being O(n) when you might be (1) as in these examples (when you really should notice something amiss).
I was also wondering if anyone's accidentally written a random-indexing (ie. generate a random number, if it's the desired index continue, else repeat), although that wouldn't have a worse complexity than a loop for a single index, even though it's clearly worse.
no subject
I wonder what the worst factors of unnecessary overhead are. There's plenty of examples of being O(n^2) when you could have been O(n) (surprisingly easy to do). And of being O(n) when you might be (1) as in these examples (when you really should notice something amiss).
I was also wondering if anyone's accidentally written a random-indexing (ie. generate a random number, if it's the desired index continue, else repeat), although that wouldn't have a worse complexity than a loop for a single index, even though it's clearly worse.