【STL整理】 STL中的一些算法的整理

1
random_shuffle
重排序给定范围 [first, last) 中的元素,使得这些元素的每个排列拥有相等的出现概率。

random_shuffle(RandomIt first, RandomIt last)

2
nth_element
将第n_th 元素放到它该放的位置上,左边元素都小于它,右边元素都大于它.

void nth_element (RandomAccessIterator first, RandomAccessIterator nth,
                    RandomAccessIterator last);

void nth_element (RandomAccessIterator first, RandomAccessIterator nth,
                    RandomAccessIterator last, Compare comp);

猜你喜欢

转载自www.cnblogs.com/shengwang/p/9757327.html