(C++) Sort
January 25, 2018 ยท View on GitHub
This page is about sorting and the STL algorithm std::sort.
Example: sorting a std::vector
#include <algorithm>
#include <cassert>
#include <vector>
int main()
{
std::vector<int> v = {4, 2, 3, 1};
std::sort(std::begin(v), std::end(v));
const std::vector<int> expected = {1, 2, 3, 4};
assert(v == expected);
}
STL sorting algorithms
Sorting code snippets
Types of sorting
- Beechicksort
- Bubble Sort
- Insertion Sort
- Quicksort
- Selection Sort