algorithmica-org/algorithmica

In section 7.4, the code should use a min-heap instead of a max-heap.

platelett opened this issue · 1 comments

https://en.algorithmica.org/hpc/external-memory/sorting/#:~:text=std%3A%3Apriority_queue%3C%20std%3A%3Apair%3Cint%2C%20int%3E%20%3E%20q%3B
Either change to std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int>>, std::greater<std::pair<int, int>>>, or store the additive inverse of the key in the heap, you can also create a struct that overloads the less-than operator.

Thanks for pointing it out. I ended up writing a custom struct overloading <. Also makes sense for self-documentation purposes.