Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: srinivas devaki Newsgroups: comp.lang.python Subject: _siftup and _siftdown implementation Date: Fri, 5 Feb 2016 02:20:01 +0530 Lines: 15 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 58D9sS1K4Tstx+3/zu7X5wmL/IJUrC9gs6WRlZYfqwSQ== Return-Path: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102506 _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