jheaps
jheaps copied to clipboard
heapify and addressable heap handlers
Is there a way to get AddressableHeap.Handle for elements inserted with heapify method?
Not really!
I guess you are referring to either DaryArrayAddressableHeap
or BinaryArrayAddressableHeap
.
I should add a method which also accepts a collection as argument and populates it with the handles.
Yeah, I meant on BinaryArrayAddressableHeap. Maybe a better solution would be, if it's possible at all, to provide an iterator over the handles and then users of the library can populate their collections if they need to. As I can see, BinaryArrayAddressableHeap just needs to expose an iterator over the internal array (possibly with some filtering). I don't know if it's equally simple for other heaps.
Thanks for the quick reply and for this awesome library!
Yes, an iterator over all handles is a more elegant solution. Other heaps do not have such a problem as they do not have a heapify method.