Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Sven R. Kunze" Newsgroups: comp.lang.python Subject: Re: _siftup and _siftdown implementation Date: Fri, 5 Feb 2016 01:21:50 +0100 Lines: 25 Message-ID: References: <56b3e902$0$1613$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de x4p6YlGdOQQHec6m2E5ULg6CZUIb1Wycil6U0cs/HKAA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'root': 0.04; 'library?': 0.09; 'sub': 0.09; 'url:github': 0.09; '2016': 0.16; 'code?': 0.16; 'fashion,': 0.16; 'heap': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'threading': 0.16; 'unconnected': 0.16; 'wrote:': 0.16; 'pos': 0.22; 'subject:skip:i 10': 0.22; 'am,': 0.23; 'feb': 0.23; 'implemented': 0.24; 'header:In-Reply-To:1': 0.24; 'wondering': 0.25; 'header:User-Agent:1': 0.26; 'fri,': 0.27; 'question': 0.27; 'function': 0.28; "i'm": 0.30; 'code': 0.30; 'somebody': 0.30; "d'aprano": 0.33; 'steven': 0.33; 'received:10.0': 0.34; 'so,': 0.35; 'but': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'client': 0.37; 'why': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'received:de': 0.40; 'your': 0.60; 'bring': 0.62; 'us.': 0.62; 'charset:windows-1252': 0.62; 'here:': 0.63; 'reply': 0.68; 'obvious': 0.76; "else's": 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1454631711; bh=HNZKpcH/LOAYrTAO2cz/xjE2+QGnE2B1bRP1Yu5Xucg=; h=Subject:To:References:From:Date:In-Reply-To:From; b=xeEx9UGXq784C55A4NTMs21aoOAd9xbIRWOwFPOKdFwxE/GJNGXnLrj5iqhbc6W44 82JZ3lsnQ/xzZXcevlIq2X5hngGGyWDb3xLvAExQOU78l6uUhv9OfgaVKkzG4VPwEw T81r4MGTg1K2UO5yT3HhyEZBSuawLHRNA1wxT+40= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: <56b3e902$0$1613$c3e8da3$5496439d@news.astraweb.com> X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 976 X-purgate-ID: 154282::1454631711-000018ED-B277515F/0/0 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc1 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102509 On 05.02.2016 01:12, Steven D'Aprano wrote: > On Fri, 5 Feb 2016 07:50 am, srinivas devaki wrote: > >> _siftdown function breaks out of the loop when the current pos has a valid >> parent. >> >> but _siftup function is not implemented in that fashion, if a valid >> subheap is given to the _siftup, it will bring down the root of sub heap >> and then again bring it up to its original place. >> >> I was wondering why it is so, is it just to make the code look simple??? > Hi Srinivas, > > I'm sure that your question is obvious to you, but it's not obvious to us. > Where are _siftup and _siftdown defined? Are they in your code? Somebody > else's code? A library? Which library? What do they do? Where are they > from? The question originated here: https://github.com/srkunze/xheap/pull/1#discussion_r51770210 (btw, Steven, your email client somehow breaks my threading view in thunderbird. This reply appeared unconnected to Srinivas' post.)