Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'root': 0.05; 'tree': 0.05; 'binary': 0.07; 'cache': 0.07; 'pypi': 0.07; 'dan': 0.09; 'happen.': 0.09; 'insertion': 0.09; 'lawrence': 0.09; 'python:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'trees': 0.09; 'python': 0.11; 'language.': 0.14; 'random': 0.14; 'keys.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sorts': 0.16; 'thread,': 0.16; 'which,': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'unlike': 0.19; 'fit': 0.20; '>>>': 0.22; 'python?': 0.22; 'header :User-Agent:1': 0.23; 'balancing': 0.24; 'earlier': 0.24; 'java': 0.24; '---': 0.24; "i've": 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'idea': 0.28; 'wondering': 0.29; 'am,': 0.29; "doesn't": 0.30; "i'm": 0.30; 'bunch': 0.31; 'comparison': 0.31; 'equivalent.': 0.31; 'node': 0.31; 'probably': 0.32; 'quite': 0.32; 'plans': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'library.': 0.36; "didn't": 0.36; 'useful': 0.36; 'url:org': 0.36; 'performance': 0.37; 'implement': 0.38; 'to:addr:python-list': 0.38; 'specialist': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'ian': 0.60; 'free': 0.61; 'mentioned': 0.61; 'viruses': 0.61; 'protection': 0.63; 'our': 0.64; 'more': 0.64; 'different': 0.65; 'believe': 0.68; 'mar': 0.68; 'advantages': 0.68; 'antivirus': 0.68; 'balanced': 0.84; "it'd": 0.84; 'pocket': 0.84; 'received:2': 0.84; 'aging': 0.91; 'url:ru': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Balanced trees Date: Sat, 08 Mar 2014 20:37:58 +0000 References: <87eh2d3x8h.fsf_-_@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-2-98-192-226.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: X-Antivirus: avast! (VPS 140308-0, 08/03/2014), Outbound message X-Antivirus-Status: Clean 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: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394311101 news.xs4all.nl 2977 [2001:888:2000:d::a6]:59032 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68051 On 08/03/2014 19:58, Dan Stromberg wrote: > On Sat, Mar 8, 2014 at 12:34 AM, Marko Rauhamaa wrote: >> Ian Kelly : >> >>> I already mentioned this earlier in the thread, but a balanced binary >>> tree might implement += as node insertion and then return a different >>> object if the balancing causes the root node to change. >> >> True. >> >> Speaking of which, are there plans to add a balanced tree to the >> "batteries" of Python? Timers, cache aging and the like need it. I'm >> using my own AVL tree implementation, but I'm wondering why Python >> still doesn't have one. > > I think it'd probably be a good idea to add one or more balanced > binary trees to the standard library. But I suspect it's been tried > before, and didn't happen. It might be good to add an _un_balanced > tree too, since they do quite well with random keys. > > Here's a performance comparison I did of a bunch of tree types in Python: > http://stromberg.dnsalias.org/~strombrg/python-tree-and-heap-comparison/2014-01/ > I've found this link useful http://kmike.ru/python-data-structures/ I also don't want all sorts of data structures added to the Python library. I believe that there are advantages to leaving specialist data structures on pypi or other sites, plus it means Python in a Nutshell can still fit in your pocket and not a 40 ton articulated lorry, unlike the Java equivalent. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com