-
June 18th, 2013, 02:37 PM
#1
A question regarding stl nth_element
Here is the code,
Code:
vector<int> vec;
for(int i=0;i<10;++i)
vec.push_back(i);
random_shuffle(vec.begin(), vec.end());
nth_element(vec.begin(), vec.begin()+7, vec.end());
No matter how I choose the second argument passed to nth_element, the elements in vec are always sorted as,
0,1,2,3,4,5,6,7,8,9
What is the use of second argument here?Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|