Figure: partition. Use partition to just divide the range into two groups: all elements that satisfy the predicate, followed by all elements that don't. This is all you need to answer questions like these:
Figure: nth_element. Use nth_element to put a single element in the correct n-th position it would occupy if the range were completely sorted, and with all other elements correctly preceding or following that n-th element. This is all you need to answer questions like these:
Figure: partial_sort. partial_sort does the work of nth_element, plus the elements preceding the n-th are all in their correct sorted positions. Use partial_sort to answer questions similar to those nth_element answers, but where you need the elements that match to be sorted (and those that don't match don't need to be sorted). This is all you need to answer questions like, "Who are the first-, second-, and third-place winners?" For example, partial_sort( contestants.begin(), contestants.begin()+3, contestants.end(), ScoreCompare ); puts the top three contestants, in order, at the front of the containerand no more.