blob: 657f685a16f1c92291320bf92ae005c966c47383 [file] [log] [blame]
STL generic algorithms -- in-place algorithms
Illustrate std::reverse() algorithm
<Rats live on no evil star>
>rats live on no evil staR<
2 3 4 5 6 7 8 9 10 11
11 10 9 8 7 6 5 4 3 2
Illustrate std::replace() algorithm
0 1 2 3 4 5 4 3 2 1 0
0 1 2 7 4 5 4 7 2 1 0
9 1 9 7 9 5 9 7 9 1 9
7 1 4 3 7 5
8 1 8 3 8 8
Illustrate std::rotate() algorithm
7 8 9 10 1 2 3 4 5 6
3 4 5 6 7 8 9 10 1 2
Illustrate std::partition() algorithm
10 2 8 4 6 5 7 3 9 1
middle location 5
1 2 3 4 5 6 7 8 9 10
Illustrate std::next_permutation() algorithm
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
Alpha Beta Gamma
Alpha Gamma Beta
Beta Alpha Gamma
Beta Gamma Alpha
Gamma Alpha Beta
Gamma Beta Alpha
Illustrate std::prev_permutation() algorithm
bela beal bale bael aleb albe aelb aebl able abel
Illustrate std::inplace_merge() algorithm
0 2 4 6 8 1 3 5 7 9
0 2 4 6 8 1 3 5 7 9
0 1 2 3 4 5 6 7 8 9
Illustrate std::generate() algorithm
1 2 3 4 5 6 7 8 9 10
Illustrate std::random_shuffle() algorithm
10 9 1 7 8 4 5 6 2 3
4 2 6 5 9 3 10 7 1 8
End of in-place algorithm sample program