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


Groups > comp.lang.python > #101446

Re: How to remove item from heap efficiently?

From "Sven R. Kunze" <srkunze@mail.de>
Newsgroups comp.lang.python
Subject Re: How to remove item from heap efficiently?
Date 2016-01-10 19:50 +0100
Message-ID <mailman.9.1452451826.3151.python-list@python.org> (permalink)
References <568EEC40.7070807@mail.de> <CACs7g=Bjccja67M3t4yL+07vO8iAcOB-dF5p2PgqqBwjFmbh=w@mail.gmail.com> <mailman.84.1452351069.2305.python-list@python.org> <87lh7ywqm7.fsf@nightsong.com>

Show all headers | View raw


On 09.01.2016 19:32, Paul Rubin wrote:
> "Sven R. Kunze" <srkunze@mail.de> writes:
>> Basically a task scheduler where tasks can be thrown away once they
>> are too long in the queue.
> I don't think there's a real nice way to do this with heapq.  The
> computer-sciencey way would involve separate balanced tree structures
> for the two sorting keys (think of a database table with indexes on two
> different columns).

Others suggested using an additional dict where to store the indexes of 
the items. Then, when removing an item, I just need to query the dict.

Best,
Sven

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


Thread

Re: How to remove item from heap efficiently? "Sven R. Kunze" <srkunze@mail.de> - 2016-01-08 17:45 +0100
  Re: How to remove item from heap efficiently? Paul Rubin <no.email@nospam.invalid> - 2016-01-09 10:32 -0800
    Re: How to remove item from heap efficiently? "Sven R. Kunze" <srkunze@mail.de> - 2016-01-10 19:50 +0100
    Re: How to remove item from heap efficiently? srinivas devaki <mr.eightnoteight@gmail.com> - 2016-01-12 08:38 +0530
      Re: How to remove item from heap efficiently? Paul Rubin <no.email@nospam.invalid> - 2016-01-11 19:16 -0800

csiph-web