[OT] Finding longest documents

KlausO oberhofer at users.sf.net
Tue Oct 14 01:15:01 PDT 2008


Christopher Wright schrieb:
> 
> There isn't a lot you can do to mess up a heap, but there are some minor 
> issues with yours:
> 1. It only has one direction (which isn't documented).
> 2. It has a key/value pair as its element type.
> 3. It's only keyed on ints.

I admit, the implementation has a special purpose. It sorts codes by 
their propability to create Huffman codes. All these three points are
owed to this context.
So the class name "PriorityQueue" is misleading, maybe I had to choose a 
better name like "CodeByProbabilitySortingPriorityQueue" :)

> 
> My heap was apparently accepted into Tango last week, with some minor 
> fixes and cleanup (and switched into a struct rather than a class; not 
> sure I like that). The only issue I see with the fixed version is that 
> it uses recursion in a couple places where it could loop instead.
> 
> Anyway, the code's here: 
> http://dsource.org/projects/tango/browser/trunk/tango/util/container/more/Heap.d?rev=3959 
> 

Thank you for the link. I try to use your general purpose implementation.

KlausO



More information about the Digitalmars-d mailing list