- Mastering C++ Programming
- Jeganathan Swaminathan
- 109字
- 2021-07-02 18:28:50
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)).
推薦閱讀
- Power Up Your PowToon Studio Project
- Getting Started with PowerShell
- Java加密與解密的藝術(第2版)
- 精通Python自動化編程
- Android驅動開發權威指南
- Learning Hadoop 2
- Hack與HHVM權威指南
- Functional Python Programming
- Mastering Bootstrap 4
- Android熱門應用開發詳解
- PHP 7 Programming Blueprints
- Getting Started with Backbone Marionette
- 軟件測試實驗實訓指南
- Git Version Control Cookbook
- 微軟辦公軟件認證考試MOS Access 2013實訓教程