首页 > 代码库 > C++STL算法速查

C++STL算法速查

  非变易算法

/*第21章 非变易算法     Non-modifying sequence operations   21.0 advance, distance     为了了解模板,先了解一下这两个迭代器操作函数   21.1 逐个容器元素for_each     for_each  Apply function to range (template function)   21.2 查找容器元素find     find  Find value in range (function template)   21.3 条件查找容器元素find_if     find_if Find  element in range (function template)   21.4 邻近查找容器元素adjacent_find     adjacent_find  Find equal adjacent elements in range (function template)   21.5 范围查找容器元素find_first_of     find_first_of  Find element from set in range (function template)   21.6 统计等于某值的容器元素个数count     count  Count appearances of value in range (function template)   21.7 条件统计容器元素个数count_if     count_if  Return number of elements in range satisfying condition (function template)   21.8 元素不匹配查找mismatch     mismatch  Return first position where two ranges differ (function template)   21.9 元素相等判断equal     equal  Test whether the elements in two ranges are equal (function template)   21.10 子序列搜索search     search  Find subsequence in range (function template)   21.11 重复元素子序列搜索search_n     search_n  Find succession of equal values in range (function template)   21.12 最后一个子序列搜索find_end     find_end  Find last subsequence in range (function template)   21.13 本章小结:*/
View Code

 
  变易算法

/*第22章 变易算法  Modifying  sequence operations   22.1 元素复制copycopy  Copy range of elements (function template)      22.2 反向复制copy_backwardcopy_backward  Copy range of elements backwards (function template)      22.3 元素交换swapswap  Exchange values of two objects (function template)      22.4 迭代器交换iter_swapiter_swap  Exchange values of objects pointed by two iterators (function template)      22.5 区间元素交换swap_rangesswap_ranges  Exchange values of two ranges (function template)      22.6 元素变换transformtransform  Apply function to range (function template)      22.7 替换Replacereplace  Replace value in range (function template)      22.8 条件替换replace_ifreplace_if  Replace values in range (function template)      22.9 替换和复制replace_copyreplace_copy  Copy range replacing value (function template)      22.10 条件替换和复制replace_copy_ifreplace_copy_if  Copy range replacing value (function template)      22.11 填充fillfill  Fill range with value (function template)      22.12 n次填充fill_nfill_n  Fill sequence with value (function template)      22.13 随机生成元素generategenerate  Generate values for range with function (function template)      22.14 随机生成n个元素generate_ngenerate_n  Generate values for sequence with function (function template)      22.15 移除复制remove_copyremove_copy  Copy range removing value (function template)   22.16 条件移除复制remove_copy_ifremove_copy_if  Copy range removing values (function template)   22.17 移除removeremove  Remove value from range (function template)   22.18 条件移除remove_ifremove_if  Remove elements from range (function template)   22.19 不连续重复元素复制unique_copyunique_copy  Copy range removing duplicates (function template)   22.20 剔除连续重复元素uniqueunique  Remove consecutive duplicates in range (function template)   22.21 元素反向reversereverse  Reverse range (function template)   22.22 反向复制reverse_copyreverse_copy  Copy range reversed (function template)   22.23 旋转rotaterotate  Rotate elements in range (function template)   22.24 旋转复制rotate_copyrotate_copy  Copy rotated range (function template)   22.25 随机抖动random_shufflerandom_shuffle  Rearrangle elements in range randomly (function template)      22.26 随机采样random_sample...   22.27 容器分割partitionpartition  Partition range in two (function template)      22.28 容器稳定分割stable_partitionstable_partition  Divide range in two groups - stable ordering (function template)      22.29 本章小结*/
View Code

 
  排序算法

/*第23章 排序算法 Sorting: 1 sort Sort elements in range (function template)2 stable_sort Sort elements preserving order of equivalents (function template)3 partial_sort Partially Sort elements in range (function template)4 partial_sort_copy Copy and partially sort range (function template)5 nth_element Sort element in range (function template)   Binary search (operating on sorted ranges): 6 lower_bound Return iterator to lower bound (function template)7 upper_bound Return iterator to upper bound (function template)8 equal_range Get subrange of equal elements (function template)9 binary_search Test if value exists in sorted array (function template)   Merge (operating on sorted ranges): 10 merge Merge sorted ranges (function template)11 inplace_merge Merge consecutive sorted ranges (function template)12 includes Test whether sorted range includes another sorted range (function template)13 set_union Union of two sorted ranges (function template)14 set_intersection Intersection of two sorted ranges (function template)15 set_difference Difference of two sorted ranges (function template)16 set_symmetric_difference Symmetric difference of two sorted ranges (function template)   Heap: 17 push_heap Push element into heap range (function template)18 pop_heap Pop element from heap range (function template)19 make_heap Make heap from range (function template)20 sort_heap Sort elements of heap (function template)   Min/max: 21 min Return the lesser of two arguments (function template)22 max Return the greater of two arguments (function template)23 min_element Return smallest element in range (function template)24 max_element Return largest element in range (function template)25 lexicographical_compare Lexicographical less-than comparison (function template)26 next_permutation Transform range to next permutation (function template)27 prev_permutation Transform range to previous permutation (function template)*/
View Code

 
  数值算法

 

 

 

 

 

 

 

TOP

 

C++STL算法速查