Abuse of Big Oh notation

Paul Rubin no.email at nospam.invalid
Mon Aug 20 15:29:12 EDT 2012


Ian Kelly <ian.g.kelly at gmail.com> writes:
> The difference between the two is that the former is bounded by a
> constant that is fundamental to the algorithm at hand,...  S is
> clearly bounded by the constraints of actual shoes, so we can safely
> treat S as a constant and call it O(N).

Thanks, that is a good explain of what I was trying to get at.  One
quibble is in the parsing example, the constant is inherent in the
distribution of input data one expects to normally encounter, rather
than in the algorithm itself.  It's sort of like saying dictionary
access (based on hashing) is O(1), based on the variety of input data
that is normally used.  There is such a thing as pathological
(e.g. malicious) input data that causes a lot of hash collisions, making
O(n) access in the size of the dictionary.  

I suppose abnormal input should also be taken into account in examples
involving parsing if one parses potentially hostile data.



More information about the Python-list mailing list