Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41174

Re: Finding the Min for positive and negative in python 3.3 list

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'algorithm': 0.03; 'subject:python': 0.11; 'algorithm.': 0.16; 'benjamin': 0.16; 'bisect': 0.16; 'bit.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'n),': 0.16; 'sorting': 0.16; 'subject:3.3': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'sort': 0.21; 'bit': 0.21; 'header:In-Reply-To:1': 0.25; 'wrote': 0.26; 'first.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'writes:': 0.29; 'usually': 0.30; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'minimum': 0.34; 'thanks': 0.34; 'list': 0.35; 'faster': 0.35; 'so,': 0.35; 'pm,': 0.35; 'but': 0.36; 'should': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'performance': 0.39; 'to:addr:python.org': 0.39; 'takes': 0.39; 'your': 0.60; 'course.': 0.62; '2013': 0.84; 'each,': 0.84; 'oscar': 0.84; 'subject:Min': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=wvjbkf70fbiDF6r7Os4AcDNd3G9B3jhVDG1wOWxzus8=; b=VU6nN+bC3+ESktw0WaQClmQmTzzyPnClo7UhMu7iXN9GSq5Dcd/41snO877PrWMCQ/ bSgGo/DYMeDOc79LZWHGxJXo8/cVebj0ZSvx2UDFJhNNUeKESLpPlbeWLW174k+Jju7e DjPWNlqwSoTxq+LOUu2E+vDMsmodIrjpYJ6bwe92WFwgxuEw12NFB5PMfFkhIXlZkl/y Icy+l+qsdgvSaYNQlfwmpeUC8NRK1Wq3hURmbnpv+2UZ8Fid0mG55K8iGFcNQtK9VxaL u4a3GnVvpVKm7Pe0zsXYB/uYwdeQE3w8uoaafZHL/pigdf+u40/q3b+CdvmLVVwdja9W RCKw==
MIME-Version 1.0
X-Received by 10.58.50.7 with SMTP id y7mr8274577ven.24.1363174739461; Wed, 13 Mar 2013 04:38:59 -0700 (PDT)
In-Reply-To <loom.20130313T122745-552@post.gmane.org>
References <mailman.3239.1363109618.2939.python-list@python.org> <513fdcfc$0$29965$c3e8da3$5496439d@news.astraweb.com> <loom.20130313T111109-885@post.gmane.org> <CAHVvXxSLADKHqDZYpjL0o17QJ+XMjD+_0Qeg26439PSWBKamgw@mail.gmail.com> <loom.20130313T122745-552@post.gmane.org>
Date Wed, 13 Mar 2013 22:38:59 +1100
Subject Re: Finding the Min for positive and negative in python 3.3 list
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3263.1363174748.2939.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363174748 news.xs4all.nl 6989 [2001:888:2000:d::a6]:56506
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41174

Show key headers only | View raw


On Wed, Mar 13, 2013 at 10:34 PM, Wolfgang Maier
<wolfgang.maier@biologie.uni-freiburg.de> wrote:
> Oscar Benjamin <oscar.j.benjamin <at> gmail.com> writes:
>
>>
>> Sort cannot be O(log(n)) and it cannot be faster than a standard O(n)
>> minimum finding algorithm. No valid sorting algorithm can have even a
>> best case performance that is better than O(n). This is because it
>> takes O(n) just to verify that a list is sorted.
>>
>> Oscar
>>
>
> Oops, you're right of course.
> Wrote this in a hurry before and got confused a bit.
> So, the two min()s take O(n) each, the sort takes O(n),
> but the bisect takes O(log n),
> which means that sorting and bisecting together should still be faster
> than 2xmin(), although it's a bit less striking than what I wrote first.
> Thanks for the correction,
> Wolfgang

Your sort is usually going to be O(n log n), not O(log n).

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Finding the Min for positive and negative in python 3.3 list Norah Jones <nh.jones01@gmail.com> - 2013-03-12 17:03 +0000
  Re: Finding the Min for positive and negative in python 3.3 list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-13 01:57 +0000
    Re: Finding the Min for positive and negative in python 3.3 list Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-03-13 10:43 +0000
      Re: Finding the Min for positive and negative in python 3.3 list 88888 Dihedral <dihedral88888@googlemail.com> - 2013-03-14 04:45 -0700
      Re: Finding the Min for positive and negative in python 3.3 list 88888 Dihedral <dihedral88888@googlemail.com> - 2013-03-14 04:45 -0700
    Re: Finding the Min for positive and negative in python 3.3 list Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-03-13 11:23 +0000
      Re: Finding the Min for positive and negative in python 3.3 list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-13 14:12 +0000
        Re: Finding the Min for positive and negative in python 3.3 list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-13 14:37 +0000
    Re: Finding the Min for positive and negative in python 3.3 list Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-03-13 11:34 +0000
      Re: Finding the Min for positive and negative in python 3.3 list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-13 14:43 +0000
    Re: Finding the Min for positive and negative in python 3.3 list Chris Angelico <rosuav@gmail.com> - 2013-03-13 22:36 +1100
    Re: Finding the Min for positive and negative in python 3.3 list Chris Angelico <rosuav@gmail.com> - 2013-03-13 22:38 +1100
    Re: Finding the Min for positive and negative in python 3.3 list Peter Otten <__peter__@web.de> - 2013-03-13 13:00 +0100
    Re: Finding the Min for positive and negative in python 3.3 list Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-03-13 14:17 +0000

csiph-web