当前位置:网站首页>lower_ Personal understanding of bound function
lower_ Personal understanding of bound function
2022-06-11 05:03:00 【bolite】
0. Official documents
1. The header file #include< algorithm >
2. Functions and parameters :
lower_bound(first ,last, val)
first: The first address of the array of actions
last: The next address of the last position of the active array
val: To insert the elements of an array
3. Array range of action :[first,last)
4. Return value : Returns greater than or equal to val The first element position of . If all elements are less than val, Then return to last The location of , And last My position is beyond the boundary .
5. effect : Personal understanding , At present and vector Use together to input , You can sort the array in the input loop .
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n = 6;
int i = 0;
vector<int> v;
int data;
cout << " Input :";
for (i; i < n; i++) {
cin >> data;
v.insert(lower_bound(v.begin(), v.end(), data), data);
}
cout << " Output :";
for (i = 0; i < n; i++) {
cout << v[i] << " ";
}
}

6. Compare :STL Of set You can also do automatic sorting , however set The sorting of cannot be repeated , This function can be used to sort data containing duplicates , Change the function from small to large ,upper_bound() You can sort from large to small , The parameters are consistent with those described in the article
边栏推荐
- Click the icon is not sensitive how to adjust?
- Traversal of binary tree -- restoring binary tree by two different Traversals
- Tightly coupled laser vision inertial navigation slam system: paper notes_ S2D. 66_ ICRA_ 2021_ LVI-SAM
- Yolov5 training personal data set summary
- Use pathlib instead of OS and os Common methods of path
- Zed2 running vins-mono preliminary test
- Top 100 video information of station B
- Crmeb/v4.4 Standard Version open version mall source code applet official account h5+app mall source code
- MySQL nested sorting: first sort and filter the latest data, and then customize the sorting of this list
- Tips and websites for selecting papers
猜你喜欢

Vins fusion GPS fusion part

Using keras to build the basic model yingtailing flower

Conversion relationship between coordinate systems (ECEF, LLA, ENU)

IOU series (IOU, giou, Diou, CIO)

Lr-link Lianrui fully understands the server network card

Thesis 𞓜 jointly pre training transformers on unpaired images and text
![[Transformer]MViTv2:Improved Multiscale Vision Transformers for Classification and Detection](/img/97/a3e91e703b01aaceeb0d61545f9609.jpg)
[Transformer]MViTv2:Improved Multiscale Vision Transformers for Classification and Detection

Codesys get System Time

Technology | image motion drive interpretation of first order motion model

PHP phone charge recharge channel website complete operation source code / full decryption without authorization / docking with the contract free payment interface
随机推荐
go单元测试实例;文件读写;序列化
Yolov5 training personal data set summary
Network adapter purchase guide
Tightly coupled laser vision inertial navigation slam system: paper notes_ S2D. 66_ ICRA_ 2021_ LVI-SAM
Exhibit express: Lianrui will bring three new products of the industry to debut in visionchina (Shenzhen) 2021
Leetcode question brushing series - mode 2 (datastructure linked list) - 83:remove duplicates from sorted list
PHP phone charge recharge channel website complete operation source code / full decryption without authorization / docking with the contract free payment interface
Cartographer learning records: 3D slam part of cartographer source code (I)
Paper reproduction: pare
Sealem finance builds Web3 decentralized financial platform infrastructure
Leetcode question brushing series - mode 2 (datastructure linked list) - 21:merge two sorted lists merge two ordered linked lists
Batch naming picture names
Technical dry goods: how to select the most suitable RDMA network card
The programmers of a large factory after 95 were dissatisfied with the department leaders, and were sentenced for deleting the database and running away
KD-Tree and LSH
董明珠称“格力手机做得不比苹果差”哪里来的底气?
Real time update of excellent team papers
Simple linear regression of sklearn series
华为设备配置通过GRE隧道接入虚拟专用网
Huawei device configuration bgp/mpls IP virtual private network command