Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102506

_siftup and _siftdown implementation

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From srinivas devaki <mr.eightnoteight@gmail.com>
Newsgroups comp.lang.python
Subject _siftup and _siftdown implementation
Date Fri, 5 Feb 2016 02:20:01 +0530
Lines 15
Message-ID <mailman.72.1454619005.30993.python-list@python.org> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de 58D9sS1K4Tstx+3/zu7X5wmL/IJUrC9gs6WRlZYfqwSQ==
Return-Path <mr.eightnoteight@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.029
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'root': 0.04; 'sub': 0.09; '+91': 0.15; 'fashion,': 0.16; 'heap': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'student': 0.20; 'junior': 0.22; 'pos': 0.22; 'subject:skip:i 10': 0.22; 'implemented': 0.24; 'wondering': 0.25; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'code': 0.30; 'received:google.com': 0.35; 'so,': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'indian': 0.36; 'to:addr:python- list': 0.36; 'received:209.85.213': 0.37; 'received:209': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'school': 0.62; 'bring': 0.62; '(3rd': 0.84; 'ph:': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=tPPRMq2VTu+vylSXFqqEQ2iPt/zhvafFRcNRt0sSr4s=; b=yknl08lxUNmWD9O0DnOzOz8gBO8qflA3jfDVw9Oh2eRzLlgITWpVyldFeEK2JiTlSc 0TIL8IffICRGdyKS76Bv/zpzBvbuMM/eqDY41kc/l7EX936jEQsIsGx1jj8RIOB+nXv2 46gEkD3ASwEuRXYSzBj0wEhL/vag8Q3lohN/qUpgQqhqgeVaJZeVwYgK95XFTVvLhBOr a08DmJlJdF9aYQu/uwl+xr5vTlpL/iLFFOyt9P+XMbbbuvs1hHJ2vsUKZ3rwZkNDQDZN SlhCOp9xuTWHzFpLTdxvDGtFMuiOUydue1XjAYiq2HZJGAIVceAMvyF0FUNaC3vUM8dm c3vA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=tPPRMq2VTu+vylSXFqqEQ2iPt/zhvafFRcNRt0sSr4s=; b=BzOHFWBu3RUOhY47xX6TCA6+1/KIDRvuyhiBX7hbecbcg49Gp5cNqqmtND2mxnNGdO xQyT/kMfm5v/BF71xuE+PcGIntMB0ojyoggv2qtfEt9j6OeCDuV3x2hKF9yXA1RHrr6O mfDcUpv8i5GYTNFp6VXP89vYcmVvFwhNTn9WLA9b2qG0RRsyeMPQe0/p4Dqn7SkGq6NJ L9zUD9iVnCgedNS1YiQ2GnB34W7ZuNbY644xlYhfEAV7hGw+cMqrMfDuJfibINtuDHgL FJr9sHNBPW5nSm30LyQgj0bRcVzSyd9DI25bZSfQmRwSZZoHCfGzGPPBDZ1rL0znQ8aa AvAQ==
X-Gm-Message-State AG10YOQ8YDenVvlxbvSFTumtgwYUEqkfN1vKVJzi1tcGiZKU40UlrT7aRU7XoeAu7JkdybV+qOWRlTSsJRWmiA==
X-Received by 10.50.40.38 with SMTP id u6mr6248210igk.15.1454619002217; Thu, 04 Feb 2016 12:50:02 -0800 (PST)
X-Content-Filtered-By Mailman/MimeDel 2.1.21rc1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc1
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:102506

Show key headers only | View raw


_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???

Regards
Srinivas Devaki
Junior (3rd yr) student at Indian School of Mines,(IIT Dhanbad)
Computer Science and Engineering Department
ph: +91 9491 383 249
telegram_id: @eightnoteight

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

_siftup and _siftdown implementation srinivas devaki <mr.eightnoteight@gmail.com> - 2016-02-05 02:20 +0530
  Re: _siftup and _siftdown implementation Steven D'Aprano <steve@pearwood.info> - 2016-02-05 11:12 +1100
    Re: _siftup and _siftdown implementation "Sven R. Kunze" <srkunze@mail.de> - 2016-02-05 01:21 +0100
    Re: _siftup and _siftdown implementation srinivas devaki <mr.eightnoteight@gmail.com> - 2016-02-05 06:56 +0530
    Re: _siftup and _siftdown implementation "Sven R. Kunze" <srkunze@mail.de> - 2016-02-05 15:42 +0100
    Re: _siftup and _siftdown implementation Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-05 12:48 -0200
    Re: _siftup and _siftdown implementation "Sven R. Kunze" <srkunze@mail.de> - 2016-02-05 15:55 +0100
    Re: _siftup and _siftdown implementation Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-05 12:59 -0200
    Re: _siftup and _siftdown implementation srinivas devaki <mr.eightnoteight@gmail.com> - 2016-02-05 21:15 +0530
    Re: _siftup and _siftdown implementation "Sven R. Kunze" <srkunze@mail.de> - 2016-02-05 17:27 +0100
    Re: _siftup and _siftdown implementation "Sven R. Kunze" <srkunze@mail.de> - 2016-02-05 17:35 +0100
    Re: _siftup and _siftdown implementation srinivas devaki <mr.eightnoteight@gmail.com> - 2016-02-05 23:12 +0530
    Re: _siftup and _siftdown implementation srinivas devaki <mr.eightnoteight@gmail.com> - 2016-02-06 20:16 +0530

csiph-web