jheaps icon indicating copy to clipboard operation
jheaps copied to clipboard

heapify and addressable heap handlers

Open stanojevic opened this issue 6 years ago • 3 comments

Is there a way to get AddressableHeap.Handle for elements inserted with heapify method?

stanojevic avatar Jan 09 '19 14:01 stanojevic

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.

d-michail avatar Jan 09 '19 19:01 d-michail

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!

stanojevic avatar Jan 09 '19 21:01 stanojevic

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.

d-michail avatar Jan 10 '19 10:01 d-michail