官术网_书友最值得收藏!

Code walkthrough

The following line declares a vector and initializes the vector with five elements:

vector<int> v = { 1, 5, 2, 4, 3 };

However, a vector also allows appending values to the end of the vector by using the vector::push_back<data_type>( value ) API. The sort() algorithm takes two random access iterators that represent a range of data that must be sorted. As the vector internally uses a built-in C/C++ array, just like the STL array container, a vector also supports random access iterators; hence the sort() function is a highly efficient algorithm whose runtime complexity is logarithmic, that is, O(N log2 (N)).

主站蜘蛛池模板: 平泉县| 长白| 宿州市| 蕉岭县| 安庆市| 凉山| 平昌县| 桐庐县| 泸水县| 孟连| 淮北市| 衡东县| 天水市| 德化县| 许昌市| 沁阳市| 鹿邑县| 株洲县| 兴业县| 合江县| 汤原县| 崇信县| 棋牌| 藁城市| 西峡县| 安新县| 松溪县| 无棣县| 浑源县| 樟树市| 靖州| 清水河县| 大新县| 固原市| 曲麻莱县| 桦川县| 通州市| 宜春市| 蕲春县| 高安市| 讷河市|