On Thu, Sep 13, 2012 at 2:39 PM, Prasad, Ramit <ramit.pra...@jpmorgan.com> wrote: > Dwight Hutto wrote: >> Why don' you just time it,eit lops through incrementing thmax input/ > > What? Without context I have no idea what this means. > > > Ramit
Why don't you read the OP: Let's assume you're testing two strings for equality. You've already done the obvious quick tests (i.e they're the same length), and you're down to the O(n) part of comparing every character. I'm wondering if it might be faster to start at the ends of the strings instead of at the beginning? If the strings are indeed equal, it's the same amount of work starting from either end. But, if it turns out that for real-life situations, the ends of strings have more entropy than the beginnings, the odds are you'll discover that they're unequal quicker by starting at the end. > and this one from me: First include len(string)/2, in order to include starting at the center of the string, and threading/weaving by 2 processes out. import timeit do the the rest, and see which has the fastest time.> -- > Why don't take the time to read the OP, and ramit in your head? Remember that you're in the middle of a conversation where the OP is following as it goes along, so anyone reading the entire set of postings should get it. But for people who just want to jump in, and assume that the only thing that matters is one piece, without reading the entire content of the conversation, will always have something out of context for them. -- Best Regards, David Hutto CEO: http://www.hitwebdevelopment.com -- http://mail.python.org/mailman/listinfo/python-list