Hacker News new | ask | show | jobs
by wging 4365 days ago
Total tangent, but it occurs to me that if all you want is the minimum item, you maybe don't even need a minheap. You can just keep a single item--the smallest--and replace the operation of adding to the array with the operation of compare-and-possibly-replace.
1 comments

As long as you don't need to remove items or update their costs often.