Comparing strings from the back?

Chris Angelico rosuav at gmail.com
Thu Sep 6 08:29:09 EDT 2012


n Thu, Sep 6, 2012 at 10:13 PM, Roy Smith <roy at panix.com> wrote:
> In article <50485fca$0$29977$c3e8da3$5496439d at news.astraweb.com>,
>  Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
>
>> In any case, the *worst* case for string equality
>> testing is certainly O(N) (every character must be looked at), and the
>> *best* case is O(1) obviously (the first character fails to match).
>
> The best case is O(0), if either string is empty (ducking and running).

No, O(0) would be when the application decides not to compare at all.

ChrisA (also ducking)



More information about the Python-list mailing list