Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.167 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.69; '*S*': 0.03; 'assume': 0.14; 'random': 0.14; 'given,': 0.16; 'guess.': 0.16; 'subject:search': 0.16; 'worst': 0.16; 'wrote:': 0.18; 'wed,': 0.18; "hasn't": 0.19; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'received:google.com': 0.35; 'there': 0.35; 'oracle': 0.36; 'surely': 0.36; "didn't": 0.36; 'wrong': 0.37; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'enough': 0.39; 'space': 0.40; 'ian': 0.60; 'first': 0.61; 'repeat': 0.74; '2015': 0.84; 'subject:find': 0.84; 'subject:Best': 0.91; 'average': 0.93; 'lucky': 0.93 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=x7/MrFkDDCAIaEl9mQOCiC84QrzNfjdL19i8DqUqDfw=; b=giowPS5jZmaPTcafhmpn32dBy0iEPQQv7mpnkbZtpX9gxtmC3cIu66TKnIWo0CEOEh wmycHrQvH0ZBbnTS7GfKZVuEVdtECA1yGpRXx/hKH1Qclfv1SjBAFOzU0ptCxSXcORmO CzVhxV3wlML7QZCl1a8A/2pvJ7mH6X+uBFBBPs9h6rhiyDxoV4rFyAMa/zmjKNCF8O+c cAt5AI/wNbJmEBhoVkBWBjoDYwCpNwGkuTk3oprCYh/xLFtDnumasMPBfQKeDsSQFMMw 5VZ6bLXb00lwqdFuzREAKmSvNsRn7sUbzLa6aSHiaUoVljIIaJNJGzpttKxTPBblWsWu 0tDg== X-Received: by 10.107.11.81 with SMTP id v78mr18925736ioi.66.1428449472811; Tue, 07 Apr 2015 16:31:12 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <55246057$0$12986$c3e8da3$5496439d@news.astraweb.com> References: <2e3a3c01-20b3-4948-9b32-bd80ed46822b@googlegroups.com> <55246057$0$12986$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Tue, 7 Apr 2015 17:30:32 -0600 Subject: Re: Best search algorithm to find condition within a range To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1428449476 news.xs4all.nl 2826 [2001:888:2000:d::a6]:52975 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88629 On Tue, Apr 7, 2015 at 4:55 PM, Steven D'Aprano wrote: > On Wed, 8 Apr 2015 12:32 am, Ian Kelly wrote: > >> On average, a random Oracle with a search space of 1000000 will need >> 1000000 guesses. > > Surely on average it will only take 500000 guesses? > > Best case is that it gets lucky the first time (1 guess). Worst case is that > it guesses every wrong answer until there is only one answer it hasn't > given, which is right (1000000 guesses). I assume that the Oracle is smart > enough to never repeat a guess. I didn't make that assumption. With replacement, the mean is 1000000, per the binomial distribution.