STL
Explore how to apply C++ STL sorting techniques and define custom comparator functions to sort arrays or vectors by various criteria. Learn to implement sorting that handles odd and even integers differently, enhancing your skills for competitive programming challenges.
We'll cover the following...
We'll cover the following...
C++ STL
Here’s what we will be doing when we have to sort an array or vector.
Array
Vector #
The actual sorting algorithm used will depend on the language but these are generally faster sorting algorithms of the order .
Custom comparator
The sort function sorts the integers in non-decreasing order. For other data types, default comparison is used. For example:
float- same asint.pair<first, second>- the first part of the pair is compared first. If they are the same, then the second part is compared.