Chris Rebert wrote: > On Thu, Feb 26, 2009 at 10:26 PM, odeits <ode...@gmail.com> wrote: [...] >> while 'a' in L: >> L.remove('a') >> >> not the most efficient but it works > > "Not the most efficient"; it's terribly inefficient! It's 2*O(M*N) [M > = number of 'a's in L], versus just N. And that's not even accounting > for all the extra element movement done by .remove() > Surely 2*O(M*N) is O(M*N) since constant factors are irrelevant in assessing performance order?
regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list