Drowning in a teacup?

Ian Kelly ian.g.kelly at gmail.com
Fri Apr 1 17:16:50 EDT 2016


On Fri, Apr 1, 2016 at 3:10 PM, Chris Kaynor <ckaynor at zindagigames.com> wrote:
> The overall algorithm is O(n^2), as its doing a O(n) operation in a O(n)
> loop:

Depends on whether the OP expects to find only one match or
potentially multiple matches in the list. E did say "if one of the
elements matches".

If there are only ever a constant number of matches, then it's O(n) overall.



More information about the Python-list mailing list