From: "Paul Menage" <menage@google.com>
To: balbir@linux.vnet.ibm.com
Cc: akpm@linux-foundation.org, containers@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Priority heap infrastructure enhancements
Date: Sat, 21 Jun 2008 09:03:44 -0700 [thread overview]
Message-ID: <6599ad830806210903p396bb856q16143f5f28a9f6f2@mail.gmail.com> (raw)
In-Reply-To: <485CB652.90801@linux.vnet.ibm.com>
On Sat, Jun 21, 2008 at 1:05 AM, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
> I would like to be able to drop the smallest value. Since we cannot drop the
> smallest value, dropping a leaf (heap->size) should be sufficiently good enough.
> I want a max heap and losing the root of the heap does not work for me.
Dropping the last element will give you an "approximate-max" heap -
once you've finished building the heap, for a heap depth of N I think
the first N-1 calls to heap_delete_max() will give correct results,
but any time after that you could be missing things that were dropped
incorrectly during the building phase.
If this is OK for what you're trying to do, then either:
- adding a adding a heap_insert_drop_leaf_on_overflow() function, or
- adding a flag to the heap structure indicating what to do on overflow
sounds fine.
Paul
next prev parent reply other threads:[~2008-06-21 16:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-18 13:48 Balbir Singh
2008-06-21 7:29 ` Paul Menage
2008-06-21 8:05 ` Balbir Singh
2008-06-21 8:11 ` Paul Menage
2008-06-21 8:54 ` Balbir Singh
2008-06-21 16:03 ` Paul Menage [this message]
2008-07-01 8:14 ` Andrew Morton
2008-07-01 8:33 ` Balbir Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6599ad830806210903p396bb856q16143f5f28a9f6f2@mail.gmail.com \
--to=menage@google.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®