|
Boost : |
Subject: Re: [boost] [gsoc] heaps
From: Raymond Wan (r.wan_at_[hidden])
Date: 2010-06-11 11:46:20
Hi Dave,
On Fri, Jun 11, 2010 at 23:57, David Abrahams <dave_at_[hidden]> wrote:
> At Fri, 11 Jun 2010 23:07:19 +0900,
> Raymond Wan wrote:
>> That is, maybe a max-heap shouldn't be interchangeable with a priority
>> queue? Â Or, that a heap should have been part of std first...but I
>> presume this project's aim is to correct this omission? Â :-)
>
> Don't forget, the standard also has heap algorithms that use the same
> default sort criterion.
Oh! Opps...yes, sorry, I did forget about that! Thanks!
Of course, I don't know the reasons why the standard uses the >
operator. Personally, I think we're just talking about things from
two different ends. I'm just saying that the term "heap" doesn't
imply either operator. Out of convenience, books and the C++ standard
made a choice and they happened to have made different choices...but
neither is more correct than the other. Likewise, if a max-heap was
used to follow what std already does, then there is nothing wrong to
explicitly say in the documentation that "by default" a "max-heap is
built".
I was just looking at some std heap documentation (to refresh my
memory :-) ) and it says, "Internally, a heap is a tree where each
node links to values not greater than its own value." [1] I would say
that this statement is incorrect...but that's just me being picky.
:-)
Thank you for correcting me!
Ray
[1] http://www.cplusplus.com/reference/algorithm/make_heap/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk