This program illustrates the use of the STL nth_element() algorithm (extended version) to partition a vector of integers of size 12 around its 7th element. The ranges on either side of this value may or may not be sorted, but the algorithm does not guarantee this, and you should not expect it. In this case the order of the elements is determined by one integer preceding another if and only if it has a smaller digit sum. Press Enter to continue ... Here are the initial contents of the vector: 92 21 53 84 46 13 41 76 45 61 11 15 Press Enter to continue ... Now we make the following call: nth_element(v.begin(), v.begin()+6, v.end()); Press Enter to continue ... And here are the contents of the vector partitioned around its 7th element: 11 21 13 41 15 61 53 45 46 92 84 76 Press Enter to continue ...