Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.042 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'algorithm': 0.03; '21,': 0.07; 'variable,': 0.07; 'argument,': 0.09; 'assumed': 0.09; 'notation': 0.09; 'aug': 0.13; 'size,': 0.13; 'amortized': 0.16; 'biological': 0.16; 'discusses': 0.16; 'heap': 0.16; 'invalid.': 0.16; 'subject:Big': 0.16; 'variable.': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'variable': 0.20; 'sort': 0.21; 'constant': 0.22; 'controlled': 0.22; 'latter': 0.22; 'logical': 0.22; 'paul': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'possibly': 0.27; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'actual': 0.28; 'chris': 0.28; 'behaviour': 0.29; 'factor': 0.29; 'measure': 0.29; 'seeks': 0.29; 'sense': 0.31; 'material': 0.33; 'mass': 0.33; 'safely': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'received:209.85': 0.35; 'really': 0.36; 'but': 0.36; '(i.e.': 0.36; 'be.': 0.36; 'does': 0.37; 'two': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'space': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'real': 0.61; 'first': 0.61; 'between': 0.63; 'more': 0.63; 'limit': 0.65; 'total': 0.65; '20,': 0.65; 'theoretical': 0.65; 'treat': 0.65; 'sum': 0.66; 'increase': 0.72; '"what': 0.84; 'bounded': 0.84; 'construct': 0.84; 'presumably': 0.84; 'subject:Abuse': 0.84; 'to:name:python': 0.84; '"how': 0.91; 'increases': 0.91; 'shoes,': 0.91; 'hand,': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=mqvQpHpS0tKEVwUk39GNvqB2keggxmINRHH7qUV1t6U=; b=IWOdj+/haUBdlPTxOQrG+DFa+gXTZjWpe4oePLB/pn/i6ONO+otu0UYhitPWmeZqBp xNdqI919fgt4wjWZEKysOetQ5mqlWalbmTmxd2/wJjFqcnwwgxht3+bPxPo0nD5ScBMJ 8YoIWsMdjnENDT6YHt+JTt07xnJbyAb7xvUcN660wJr0hBM50pS0nAEdyhyYdMrvy++j Vo//FA01K4sQj8u7YZ9E5M7gjADd5wchgEc2dKsDFPKbHX7hVNtHHOlMQdz778oRJCMB ajtBQCrnq5F/n2RvTHoR6c+K0v6yFvchUsALqa7Km/YJXCa2r+M1rLrf/OmiXBq3aaeK 3sJg== MIME-Version: 1.0 In-Reply-To: References: <308df2af-abe7-4043-b199-0a39f440e0ab@googlegroups.com> <502f8a2a$0$29978$c3e8da3$5496439d@news.astraweb.com> <7xehn4vyya.fsf@ruckus.brouhaha.com> <5030832d$0$29978$c3e8da3$5496439d@news.astraweb.com> <7x8vdbmho6.fsf@ruckus.brouhaha.com> <7xfw7ilqnd.fsf@ruckus.brouhaha.com> <50314968$0$29978$c3e8da3$5496439d@news.astraweb.com> <7xwr0ua1pw.fsf@ruckus.brouhaha.com> <7xr4r1pn72.fsf@ruckus.brouhaha.com> From: Ian Kelly Date: Mon, 20 Aug 2012 11:12:22 -0600 Subject: Re: Abuse of Big Oh notation To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345482779 news.xs4all.nl 6888 [2001:888:2000:d::a6]:43728 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27510 On Mon, Aug 20, 2012 at 10:09 AM, Chris Angelico wrote: > On Tue, Aug 21, 2012 at 2:01 AM, Paul Rubin wrote: >> Analogy: how big a box is required to hold a pair of shoes? In a purely >> theoretical sense we might say O(S) where S is the shoe size, treating >> shoe size as an arbitrary independent variable. But in the real world, >> shoe size is controlled by the size of human feet, which is bounded by a >> constant for biological reasons. You don't have to consider shoes the >> size of Jupiter. So it is O(1). > > By that argument, everything is amortized O(1), because there's a > limit on every variable. You can't possibly be working with a data set > greater than the total sum of storage space in the entire world. That > still doesn't mean that bubble sort and heap sort are equivalently > efficient. The difference between the two is that the former is bounded by a constant that is fundamental to the algorithm at hand, whereas the latter is bounded only by available resources. By any practical consideration the latter must be considered a variable, but the former need not be. Paul discusses above the asymptotic growth of a variable as O(S) where S is shoe size, but really this measure makes no sense in the first place. The question that this notation seeks to answer is, "What is the big-Oh behaviour of this variable as shoe size increases indefinitely (i.e. to infinity)?" and the answer in this case is "Shoe size does not increase indefinitely"; the question is invalid. A more logical question might be, "How much material do I need to construct N shoes of size S?" The answer to this question would presumably be some constant factor of N * S**2, which is O(N * S**2). Although N can be assumed to vary freely (up to nonsensical quantities like the mass of the entire universe), S is clearly bounded by the constraints of actual shoes, so we can safely treat S as a constant and call it O(N).