Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.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.039 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'tree': 0.05; 'granted,': 0.07; 'dan': 0.09; 'trees': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'cc:name:python list': 0.16; 'previously,': 0.16; 'tends': 0.16; 'sat,': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'library,': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'generally': 0.29; 'compared': 0.30; 'message-id:@mail.gmail.com': 0.30; 'bunch': 0.31; 'comparison': 0.31; 'faster,': 0.31; 'probably': 0.32; 'cases': 0.33; 'table': 0.34; 'equal': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'easily': 0.37; 'performance': 0.37; 'pm,': 0.38; 'major': 0.40; 'even': 0.60; 'mentioned': 0.61; 'choose': 0.64; 'more': 0.64; 'different': 0.65; 'between': 0.67; 'mar': 0.68; 'beat': 0.68; 'detail.': 0.68; 'sweet': 0.74; 'actually,': 0.84; 'balanced': 0.84 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=GVe4lMESpczQn65vHqblfEA8dfxfuFOTbfRFEMoz3Vo=; b=pGgUGQUXhl7py4Q+i9RoyJMoapTx9WPaavWT7xz9wHZuStw0h+uT9+3w0KtM7UI7U4 7Z06zOu6MeiW5wWQ+FgXfNo/s4CkKCQn4hSEXiOITZ2BjV5mv6333wenoliivN3i7MJp sCT5t5sviKWRXHNnXCg9ZFmy6TnD8RD+NlAZ4L3L3fb/n119m6XXUKjLXT5m/9GRd+1Q +cmBoi14teyIAk2iwNE92JhLNV1qVenLQxeElyT6UxbR1pyR3U4104BQYsMK94dYLfCF TYEX+2UFWrH/yOvZajXZYXuS1RzOxBf2xYsz+PgquyA5WA9M+19dOelPd98ffsp7NbGi celw== MIME-Version: 1.0 X-Received: by 10.236.83.84 with SMTP id p60mr155906yhe.111.1394400011422; Sun, 09 Mar 2014 14:20:11 -0700 (PDT) In-Reply-To: <87zjkz3eo3.fsf@elektro.pacujo.net> References: <87eh2d3x8h.fsf_-_@elektro.pacujo.net> <87eh2ctmht.fsf@elektro.pacujo.net> <87zjkz3eo3.fsf@elektro.pacujo.net> Date: Sun, 9 Mar 2014 14:20:11 -0700 Subject: Re: Balanced trees From: Dan Stromberg To: Marko Rauhamaa 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394400019 news.xs4all.nl 2970 [2001:888:2000:d::a6]:46223 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68091 On Sun, Mar 9, 2014 at 1:27 AM, Marko Rauhamaa wrote: > Dan Stromberg : > >> On Sat, Mar 8, 2014 at 1:21 PM, Marko Rauhamaa wrote: >>> If I had to choose between a hash table and AVL (or RB) tree in the >>> standard library, it would definitely have to be the latter. It is more >>> generally usable, has fewer corner cases and probably has an equal >>> performance even in hash tables' sweet spot. >> >> Actually, in the performance comparison I mentioned previously, I >> compared Python dict's to a bunch of different balanced trees and one >> unbalanced tree. The dictionary was much faster, though granted, it >> was the only one in C. > > Yes, that is one major detail. There must be many more. This is not just a detail: O(1) tends to be beat O(logn) pretty easily for large n.