Translations of this page?:

C++ 算法

下列函数在<algorithm> 或者 <numeric>中定义,属于stl命名空间(namespace)。

accumulate将一段范围的元素累加
adjacent_difference计算一个范围相邻元素的差
adjacent_find查找相同的两个相邻元素或者具有某种关系的两个相邻元素
binary_search判断在某个范围是否存在某个元素
copy把一段范围元素拷贝到另一个位置
copy_backward把一段范围元素反向拷贝到另一个位置
count返回匹配某个值的元素个数
count_if返回满足某个条件的元素个数
equal判断两个集合是否相等
equal_range查找与某个值相等的一段元素
fill将一个值赋给某一范围元素
fill_n把某个值赋给某个范围一定数目的元素
find在一个给定范围查找某个值
find_end在某个范围查找某个元素序列
find_first_ofsearch for any one of a set of elements
find_iffind the first element for which a certain predicate is true
for_each将一个函数应用于某个范围的元素
generatesaves the result of a function in a range
generate_nsaves the result of N applications of a function
includesreturns true if one set is a subset of another
inner_productcompute the inner product of two ranges of elements
inplace_mergemerge two ordered ranges in-place
is_heap判断一个范围的元素是否构成堆
iter_swapswaps the elements pointed to by two iterators
lexicographical_comparereturns true if one range is lexicographically less than another
lower_boundsearch for the first place that a value can be inserted while preserving order
make_heap将某个范围元素构造为堆
max返回两个元素中较大的元素
max_element返回某个范围中最大的元素
merge将两段有序元素序列合并成有序序列
minreturns the smaller of two elements
min_elementreturns the smallest element in a range
mismatchfinds the first position where two ranges differ
next_permutationgenerates the next greater lexicographic permutation of a range of elements
nth_elementput one element in its sorted location and make sure that no elements to its left are greater than any elements to its right
partial_sort将某个范围的前N个元素排序
partial_sort_copycopy and partially sort a range of elements
partial_sumcompute the partial sum of a range of elements
partition将某段范围元素分为两组
pop_heap将堆的最大元素删除
prev_permutationgenerates the next smaller lexicographic permutation of a range of elements
push_heap在堆中添加一个元素
random_shufflerandomly re-order elements in some range
removeremove elements equal to certain value
remove_copycopy a range of elements omitting those that match a certain value
remove_copy_ifcreate a copy of a range of elements, omitting any for which a predicate is true
remove_ifremove all elements for which a predicate is true
replacereplace every occurrence of some value in a range with another value
replace_copycopy a range, replacing certain elements with new ones
replace_copy_ifcopy a range of elements, replacing those for which a predicate is true
replace_ifchange the values of elements for which a predicate is true
reversereverse elements in some range
reverse_copycreate a copy of a range that is reversed
rotatemove the elements in some range to the left by some amount
rotate_copycopy and rotate a range of elements
searchsearch for a range of elements
search_nsearch for N consecutive copies of an element in some range
set_differencecomputes the difference between two sets
set_intersectioncomputes the intersection of two sets
set_symmetric_differencecomputes the symmetric difference between two sets
set_unioncomputes the union of two sets
sort将某段元素按照递增序排序
sort_heap将一个堆排序
stable_partitiondivide elements into two groups while preserving their relative order
stable_sort稳定的排序
swapswap the values of two objects
swap_rangesswaps two ranges of elements
transformapplies a function to a range of elements
unique删除连续重复出现的元素
unique_copycreates a copy of some range of elements that contains no consecutive duplicates
upper_boundsearches for the last place that a value can be inserted while preserving order (first place that is greater than the value)
 
• • • SitemapRecent changesRSScc