Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1a.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.066 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'tree': 0.05; 'lookup': 0.09; 'term,': 0.09; 'cc:addr:python-list': 0.11; 'big,': 0.16; 'cc:name:python list': 0.16; 'constants.': 0.16; 'does,': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'values': 0.27; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'node': 0.31; 'quite': 0.32; 'table': 0.34; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'performance': 0.37; 'ahead': 0.38; 'depends': 0.38; 'most': 0.60; 'course': 0.61; 'costs': 0.63; 'mar': 0.68; 'real-world': 0.68; 'smith': 0.68; 'million': 0.74; '20x': 0.84; 'million.': 0.84; 'hand,': 0.93; 'imagine': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=aYn2bPPEgubTm3CMYAeVxcVWW5rdD4hT6CjBykWbQT4=; b=fqfmWqYVf4Kt4H9HxtlKxFyrw0ee7KAzHbQZ5gRDbMtiJNZ23gCa23Uh3ZVO/KKO1y co6zI3D9rjXePIybA9cvj8OMYY5zRdE7dUsO5iinOmqSOBEDwKHTdW+0t/RHkRe0cY35 3Q4JAN/YumzhYBhpZ0gchwbrk0RfHT+ZEVL/AHLbxQwPeezdV1K+ws15XANwmHuh9zpK Xiw2sxXgVRSNRIpA71sUDwcdoXUHO/Twl+5deswYh1N4oVAaMx6kTWgPvF1h7HM8s8me GpELrcqzt1mhl9YzOlkcX2nshdS9rpEgYMeI4IYtFHkajxVt7Mc/rfiNfmBAzHAY14Sn XOmA== MIME-Version: 1.0 X-Received: by 10.236.128.170 with SMTP id f30mr19991538yhi.89.1394499915303; Mon, 10 Mar 2014 18:05:15 -0700 (PDT) In-Reply-To: References: <87eh2d3x8h.fsf_-_@elektro.pacujo.net> <87eh2ctmht.fsf@elektro.pacujo.net> <87zjkz3eo3.fsf@elektro.pacujo.net> <87a9czrrax.fsf@elektro.pacujo.net> <531d3058$0$29994$c3e8da3$5496439d@news.astraweb.com> <87eh2atw6s.fsf@elektro.pacujo.net> Date: Mon, 10 Mar 2014 18:05:15 -0700 Subject: Re: Balanced trees From: Dan Stromberg To: Roy Smith Content-Type: text/plain; charset=ISO-8859-1 Cc: Python List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394499924 news.xs4all.nl 2856 [2001:888:2000:d::a6]:56642 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68186 On Mon, Mar 10, 2014 at 6:59 AM, Roy Smith wrote: > On the other hand, log n, for n = 1 million, is just 20. It's not hard > to imagine a hash function which costs 20x what a node traversal does, > in which case, the log n lookup is ahead for all n < 1 million. FWIW, both the hash table and the tree will have constants. So a tree would be c*20 in its most significant term, and the hash table would be d*1 in its. The real-world performance depends quite a bit on those constants at small values of n. I don't really consider a million all that big, but the meaning of "big" of course depends.