Algorithms in the STL perform functions such as sorting and searching, as well as manipulating and counting data. These are called by the <algorithm> header in C++ and are used on ranges of elements. The groups of objects that are modified do not impact the structure of the container they are associated with. The patterns outlined in each of the subheadings here use Go's language structure to implement these algorithms. The following types of algorithm will be explained in this section of the chapter:
- Min and max elements
- Binary search
Being able to understand how all of these algorithms work will help you to produce performant code when you need to use these techniques to manipulate data structures using algorithms.