ore work than necessary.
A usual solution to this problem is to make a heap
with the n given elements (in linear time) and then
perform m successive extractions of the minimum element.
Historically, this has been the way in which
C++ STL’s partial sort function has been implemented
[5]. Its most prominent feature is that it guarantees
Θ(n + m log n) worst-case performance.