topN using a heap
Ilya Yaroshenko via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jan 16 21:54:46 PST 2016
On Sunday, 17 January 2016 at 03:26:54 UTC, Andrei Alexandrescu
wrote:
> On 1/16/16 9:37 PM, Timon Gehr wrote:
>> Ivan's analysis suggests that even something significantly
>> larger, like
>> n/log(n)² might work as an upper bound for k.
>
> I'm not clear on how you got to that boundary. There are a few
> implementation details to be minded as well (quickly and
> carefully approximating the log etc). Could you please make a
> commented pull request against my own? Thanks! -- Andrei
size_t.sizeof * 8 - bsr(n) should be good approximation for
sorting. --Ilya
More information about the Digitalmars-d
mailing list