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


Groups > comp.lang.python > #102743

Re: Heap Implementation

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From srinivas devaki <mr.eightnoteight@gmail.com>
Newsgroups comp.lang.python
Subject Re: Heap Implementation
Date Wed, 10 Feb 2016 06:57:14 +0530
Lines 19
Message-ID <mailman.7.1455067638.7749.python-list@python.org> (permalink)
References <56AD3D83.2050308@mail.de> <7C522D08-9D73-48D2-A71D-F1D1D34C02A5@gmail.com> <CACs7g=Cu=tGhU3TtBa0cYr46WP7kOHWyxz2TiHXCuiSLqb4P7A@mail.gmail.com> <185DAEA4-8728-4792-A3B7-7F6AC5A7F876@gmail.com> <CACs7g=APHr+DbmZaGz7P3RaRUGDYPqH+eniVTFenppPXXinOvQ@mail.gmail.com> <2308C08E-D2A1-4F16-800F-C2794D30F96B@gmail.com> <n9cc78$2rn$1@ger.gmane.org> <65105210-BAE5-4CD1-8C8C-73FC51982901@gmail.com> <n9ct0m$kcn$1@ger.gmane.org> <D283DC69-E9B1-4ED3-9A29-925E548A33CF@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de yacGEsJKDaCX8PFHb6VKVwkz6sxj7ZmD2+w8Kbv2MXIg==
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.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'objects,': 0.07; 'wrapper': 0.07; 'cc:addr:python-list': 0.09; 'immutable': 0.09; 'mutable': 0.09; 'objects.': 0.09; 'pointers': 0.09; '+91': 0.15; '2016': 0.16; 'element.': 0.16; 'heap': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'element': 0.18; 'pointer': 0.18; '&gt;': 0.18; 'email addr:gmail.com&gt;': 0.18; 'student': 0.20; 'cc:addr:python.org': 0.20; 'fix': 0.21; 'cc:2**1': 0.22; 'constant': 0.22; 'junior': 0.22; 'am,': 0.23; 'feb': 0.23; "python's": 0.23; 'header:In-Reply-To:1': 0.24; 'figure': 0.27; 'message-id:@mail.gmail.com': 0.27; 'list': 0.34; 'received:google.com': 0.35; 'too': 0.36; 'received:209.85': 0.36; 'indian': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'your': 0.60; 'school': 0.62; 'removal': 0.79; '(3rd': 0.84; '6:11': 0.84; 'cc:addr:yahoo.co.uk': 0.84; 'ph:': 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=h1D7oeHAF9/R3Nrcrbg9IZuv/IAZUjBwjnDGa4y2KTo=; b=DJaYzRrBNCjnCVdD/3Ps34U4Hz0VBph4rq61AXkiUUZ3c+Pc4Bw4c+TR8tR69EQ5nm dCgbiBJAJzTiSjG0I7g2HsK7spWDWxXeRnBMVRXQrJJoAGgg/858N/V/bDomW/Lvx7lK 7RhJKI8uJnSYreJIC40GYVmy/UZE6acHnAlH82XE5RXQBTf0LctOtRjcL8GOGNj7bTAj E6vdNw3zCl6grf6gMdtw3wgOk3m0RE9ncGA/pZH1TAiEsch9riPkBmFbgmCpCA54c93K S2TT3dmDxv/wlFm4fjTV0h0LnDwRYA7E/6Q8YjfEC6FcN0r94xzO/k3h+icxQXR4ERYq 9fiw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=h1D7oeHAF9/R3Nrcrbg9IZuv/IAZUjBwjnDGa4y2KTo=; b=c/1hvqwiCgeqeQevfMc8pJRJJSkcg8orXLbRpnjSeRI12U1B1VKhBOMOLd9jJZrguv CjJzaHL23NEBGLWRNWPAmdz7QBWRU2hHx1HmxLAtjvQYDhchoZZN2BgZehdi9pwBMMvQ FWsbeReRKjftGYcSW1B0WlxaRDrgRfgeqaeXuaYNyVjpbScsOqcpcSmthDcchyi+k7BW BPxA/jto/2ONU60rRlE8om3cjRLLFy5dqXogx8M/HSYqaYvz21neQMASRbUGkYjArWK9 son6OxxNlXdblSoaBG+WQb8PPTPn3HAHCS5uyx7wQsy6GHC3OHRt7Q4YLTYW3lrJJQfM 8WSw==
X-Gm-Message-State AG10YORlH02n91JmYW4nGHpTS2GUU0KsnzHv2cQ8QMPkhpVJ7QxU4B2vyAKXk8LKynIIiemInNDLHg0pbAR6fQ==
X-Received by 10.50.129.8 with SMTP id ns8mr7326814igb.81.1455067635397; Tue, 09 Feb 2016 17:27:15 -0800 (PST)
In-Reply-To <D283DC69-E9B1-4ED3-9A29-925E548A33CF@gmail.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.21rc2
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
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:102743

Show key headers only | View raw


On Feb 10, 2016 6:11 AM, "Cem Karan" <cfkaran2@gmail.com> wrote:
>
> Eh, its not too bad once you figure out how to do it.  It's easier in C
though; you can use pointer tricks that let you find the element in
constant time, and then removal will involve figuring out how to fix up
your heap after you've removed the element.
>

If you can do it with C pointers then you can do it with python's
references/mutable objects. :)
in case of immutable objects, use a light mutable wrapper or better use
list for performance.

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 | Next | Find similar | Unroll thread


Thread

Re: Heap Implementation srinivas devaki <mr.eightnoteight@gmail.com> - 2016-02-10 06:57 +0530

csiph-web