[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6599ad830806210903p396bb856q16143f5f28a9f6f2@mail.gmail.com>
Date: Sat, 21 Jun 2008 09:03:44 -0700
From: "Paul Menage" <menage@...gle.com>
To: balbir@...ux.vnet.ibm.com
Cc: akpm@...ux-foundation.org, containers@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Priority heap infrastructure enhancements
On Sat, Jun 21, 2008 at 1:05 AM, Balbir Singh <balbir@...ux.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists