Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101372
| Path | csiph.com!feeder.erje.net!2.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "Sven R. Kunze" <srkunze@mail.de> |
| Newsgroups | comp.lang.python |
| Subject | How to remove item from heap efficiently? |
| Date | Thu, 7 Jan 2016 23:52:48 +0100 |
| Lines | 17 |
| Message-ID | <mailman.66.1452258649.2305.python-list@python.org> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de Tx1Da6yBvfrrp26P43MMHQCWkeNJVK5cpxO3WJ/FjNpQ== |
| Return-Path | <srkunze@mail.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.014 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'everybody,': 0.07; 'subject:How': 0.09; 'timestamp': 0.09; '(say': 0.16; 'popping': 0.16; 'priority).': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:item': 0.16; 'subject:remove': 0.16; 'header:User- Agent:1': 0.26; 'actual': 0.28; 'received:10.0': 0.34; 'best,': 0.35; 'item': 0.35; 'problem.': 0.35; 'there': 0.36; 'to:addr :python-list': 0.36; 'subject:?': 0.36; 'received:10': 0.37; 'two': 0.37; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'received:de': 0.40; 'oldest': 0.66 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1452207170; bh=aRgIOgezlQ0WT6ITcEHGy/TeXQ/KsNZuyC4Cj7k7cEQ=; h=To:From:Subject:Date:From; b=OdLo1JNRjD1WvTIMrcztYGNoVrYJnu/c0B88NHJapIzybBIClJhu1ezfDhFLI1kE0 Tx7oSABMOfVsxr5A/eaq25PlFpwCRXAkVdLQk2NMlKcH6NX9klvP+8bMuCDmUhiSHK MHRusBfs+gurNCfUlKudNrzOgOv9wJIzWet7blig= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
| 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 | 504 |
| X-purgate-ID | 154282::1452207170-000018ED-96525F7D/0/0 |
| X-Mailman-Approved-At | Fri, 08 Jan 2016 08:10:47 -0500 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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:101372 |
Show key headers only | View raw
Hi everybody, suppose, I need items sorted by two criteria (say timestamp and priority). For that purpose, I use two heaps (heapq module): heapA # items sorted by timestamp heapB # items sorted by priority Now my actual problem. When popping an item of heapA (that's the oldest item), I need to remove the very same item from heapB, regardlessly where it is in heapB. And vice versa. Is there a datastructure or a simple trick to achieve that in an efficient matter? Best, Sven
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
How to remove item from heap efficiently? "Sven R. Kunze" <srkunze@mail.de> - 2016-01-07 23:52 +0100
csiph-web