DEV Community

Discussion on: Your complete guide to Heap data structure!

Collapse
 
aminmansuri profile image
hidden_dude

Add the option to initialize it with an array of values, because the greatest benefit of a heap is the ability to create one in O(N) time from an array of values.

Also, in real heaps you have value/priority pairs. The heap orders by priority but the actual value is can be some other object. (Unless you're simply implementing a HeapSort on numbers)

Collapse
 
ayabouchiha profile image
Aya Bouchiha

Thank you a lot for your feedback 🙏🙏