Skip to content

Glossary: Coding Interviews in C++

std::partial_sort

Also written: partial_sort

Puts only the first k items in order at the front of a range and leaves the rest unsorted, using a heap inside. It is O(m log k) and gives top k in C++.

Where the book teaches it

Related terms

HeapComparator