ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: Moving list entries from one list to another
by Alex Martelli other posts by this author
Jul 13 2002 9:12PM messages near this date
Re: Moving list entries from one list to another | Re: Moving list entries from one list to another
JB wrote:
        ...
>  bigger. I thought that when f is slow, then at least the
>  merging should be as fast as possible.

Wrong attitude.  If f is slow enough, all that matters is
minimizing the numbers of calls to f -- everything else
is secondary and might as well be optimized for clarity
and simplicity instead.


>  I thought that as have many entries, O(n) should mean "as
>  fast as possible".

As N goes to infinity, yes.  For real cases, maybe, and maybe
not.  If f(x) selects few enough x's, my first suggestion may
be generally preferable -- even though its WORST CASE
(that's what big-O notation is generally about...!) is O(N log N)
rather than O(N).  How often is the worst case encountered,
and what are the multiplicative constants in play...?


Alex

-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
JB
JB
Bengt Richter
JB
Alex Martelli
Bengt Richter
JB
JB
JB
JB
JB
JB
Bengt Richter
Alex Martelli
Alex Martelli
Alex Martelli
Emile van Sebille
=?iso-8859-1?q?Fran=E7ois?= Pinard

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved