Lesson 11 of 24
STL Algorithms: sort, reverse and find
10 min 30 XP
<algorithm> gives you ready-made sort, reverse, max_element, min_element, count, find and binary_search; <numeric> adds accumulate. One line, lots of work done.
Example: edit me and press Run
Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.sort() runs in O(n log n). binary_search only works on a sorted range.