jack: (Default)
jack ([personal profile] jack) wrote in [personal profile] andrewducker 2017-06-22 10:19 am (UTC)

:)

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.

Post a comment in response:

This account has disabled anonymous posting.
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting