It should be possible to declare a heap object, much in the same manner as it is possible to declare a hash object.
A data heap is a container of items, in which you can (very fast) get the item with the lowest key-value, https://en.wikipedia.org/wiki/Heap_(data_structure).
declare heap myheap('key','data')
Doesn't an ordered hash table do the same thing?
You are partly right. With a sorted hash structure you can easily get the minum value.
However, the timecomplexity is higher for sorted hash than for a data heap. That is because if only the minimum value is of interest, then there is no need to keep the whole list sorted.
A data heap is typically built on top of a sorted array, and keeps the whole sorted list in the array. The interest often involves building a priority list based on the ordered values of a list. I would recommend providing a more descriptive view of what you are looking for from this new data structure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.