STL算法归类
来源:互联网 发布:五金小助手软件 编辑:程序博客网 时间:2024/05/21 11:37
按照用途归了下,以便自己后面使用时快速查找(C++ referece中分类更合理,我是按照自己习惯分的,在最后列表中是C++ reference的分类)
其中使用比较多的算法大体如下:(整理的没保存,白做了从百科粘贴下吧)
一.查找
1,无序查找
1),元素查找
find返回第一个值等价于给定值的元素find_end查找范围A中与范围B等价的子范围最后出现的位置find_first_of 查找范围A中第一个与范围B中任一元素等价的元素的位置adjacent_find查找两个相邻(Adjacent)的等价(Identical)元素 mismatch 返回两个范围中第一个元素不等价的位置
2),序列查找
search在范围A中查找第一个与范围B等价的子范围的位置search_n在给定范围中查找第一个连续n个元素都等价于给定值的子范围的位置2,有序查找
binary_search判断范围中是否存在值等价于给定值的元素equal_range返回范围中值等于给定值的元素组成的子范围lower_bound返回指向范围中第一个值大于或等于给定值的元素的迭代器upper_bound返回指向范围中第一个值大于给定值的元素的迭代器二.排序
nth_element部份排序指定范围中的元素,使得范围按给定位置处的元素划分partial_sort部份排序partial_sort_copy拷贝部分排序的结果sort排序stable_sort稳定排序三.统计
transform 对指定范围中的每个元素调用某个函数以改变元素的值 count返回值等价于给定值的元素的个数count_if 返回值满足给定条件的元素的个数 includes判断一个集合是否是另一个集合的子集inplace_merge就绪合并merge合并set_difference获得两个集合的差集set_intersection获得两个集合的交集set_symmetric_difference获得两个集合的对称差set_union获得两个集合的并集max_element 返回给定范围中值最大的元素 min_element 返回给定范围中值最小的元素
四.其他
copy将一个范围中的元素拷贝到新的位置处copy_backward将一个范围中的元素按逆序拷贝到新的位置处 fill 将一个范围的元素赋值为给定值fill_n将某个位置开始的 n 个元素赋值为给定值 remove将一个范围中值等价于给定值的元素删除remove_if将一个范围中值满足给定条件的元素删除 remove_copy拷贝一个范围的元素,将其中值等价于给定值的元素删除replace将一个范围中值等价于给定值的元素赋值为新的值replace_copy拷贝一个范围的元素,将其中值等价于给定值的元素赋值为新的值reverse 反转排序指定范围中的元素C++ STL中algorithm中算法:c++ reference
Functions in <algorithm>
Non-modifying sequence operations:- all_of
- Test condition on all elements in range (function template )
- any_of
- Test if any element in range fulfills condition (function template )
- none_of
- Test if no elements fulfill condition (function template )
- for_each
- Apply function to range (function template )
- find
- Find value in range (function template )
- find_if
- Find element in range (function template )
- find_if_not
- Find element in range (negative condition) (function template )
- find_end
- Find last subsequence in range (function template )
- find_first_of
- Find element from set in range (function template )
- adjacent_find
- Find equal adjacent elements in range (function template )
- count
- Count appearances of value in range (function template )
- count_if
- Return number of elements in range satisfying condition (function template )
- mismatch
- Return first position where two ranges differ (function template )
- equal
- Test whether the elements in two ranges are equal (function template )
- is_permutation
- Test whether range is permutation of another (function template )
- search
- Search range for subsequence (function template )
- search_n
- Search range for elements (function template )
Modifying sequence operations:
- copy
- Copy range of elements (function template )
- copy_n
- Copy elements (function template )
- copy_if
- Copy certain elements of range (function template )
- copy_backward
- Copy range of elements backward (function template )
- move
- Move range of elements (function template )
- move_backward
- Move range of elements backward (function template )
- swap
- Exchange values of two objects (function template )
- swap_ranges
- Exchange values of two ranges (function template )
- iter_swap
- Exchange values of objects pointed by two iterators (function template )
- transform
- Transform range (function template )
- replace
- Replace value in range (function template )
- replace_if
- Replace values in range (function template )
- replace_copy
- Copy range replacing value (function template )
- replace_copy_if
- Copy range replacing value (function template )
- fill
- Fill range with value (function template )
- fill_n
- Fill sequence with value (function template )
- generate
- Generate values for range with function (function template )
- generate_n
- Generate values for sequence with function (function template )
- remove
- Remove value from range (function template )
- remove_if
- Remove elements from range (function template )
- remove_copy
- Copy range removing value (function template )
- remove_copy_if
- Copy range removing values (function template )
- unique
- Remove consecutive duplicates in range (function template )
- unique_copy
- Copy range removing duplicates (function template )
- reverse
- Reverse range (function template )
- reverse_copy
- Copy range reversed (function template )
- rotate
- Rotate left the elements in range (function template )
- rotate_copy
- Copy range rotated left (function template )
- random_shuffle
- Randomly rearrange elements in range (function template )
- shuffle
- Randomly rearrange elements in range using generator (function template )
Partitions:
- is_partitioned
- Test whether range is partitioned (function template )
- partition
- Partition range in two (function template )
- stable_partition
- Partition range in two - stable ordering (function template )
- partition_copy
- Partition range into two (function template )
- partition_point
- Get partition point (function template )
Sorting:
- sort
- Sort elements in range (function template )
- stable_sort
- Sort elements preserving order of equivalents (function template )
- partial_sort
- Partially sort elements in range (function template )
- partial_sort_copy
- Copy and partially sort range (function template )
- is_sorted
- Check whether range is sorted (function template )
- is_sorted_until
- Find first unsorted element in range (function template )
- nth_element
- Sort element in range (function template )
Binary search (operating on partitioned/sorted ranges):
- lower_bound
- Return iterator to lower bound (function template )
- upper_bound
- Return iterator to upper bound (function template )
- equal_range
- Get subrange of equal elements (function template )
- binary_search
- Test if value exists in sorted sequence (function template )
Merge (operating on sorted ranges):
- merge
- Merge sorted ranges (function template )
- inplace_merge
- Merge consecutive sorted ranges (function template )
- includes
- Test whether sorted range includes another sorted range (function template )
- set_union
- Union of two sorted ranges (function template )
- set_intersection
- Intersection of two sorted ranges (function template )
- set_difference
- Difference of two sorted ranges (function template )
- set_symmetric_difference
- Symmetric difference of two sorted ranges (function template )
Heap:
- push_heap
- Push element into heap range (function template )
- pop_heap
- Pop element from heap range (function template )
- make_heap
- Make heap from range (function template )
- sort_heap
- Sort elements of heap (function template )
- is_heap
- Test if range is heap (function template )
- is_heap_until
- Find first element not in heap order (function template )
Min/max:
- min
- Return the smallest (function template )
- max
- Return the largest (function template )
- minmax
- Return smallest and largest elements (function template )
- min_element
- Return smallest element in range (function template )
- max_element
- Return largest element in range (function template )
- minmax_element
- Return smallest and largest elements in range (function template )
Other:
- lexicographical_compare
- Lexicographical less-than comparison (function template )
- next_permutation
- Transform range to next permutation (function template )
- prev_permutation
- Transform range to previous permutation (function template )
0 0
- STL算法归类
- 路由算法归类
- 算法的简单归类
- 深度学习算法归类
- 排序算法归类
- 几种排序算法归类
- 图像处理基础算法归类
- 机器学习算法的归类
- 归类
- 常见排序算法--实现(归类)
- 排序算法稳定性和不稳定性归类
- STL算法
- STL 算法
- STL 算法
- STL-算法
- STL算法
- STL 算法
- STL算法
- IOS总结 静变量static、全局变量extern、局部变量、实例变量
- 程序员网址大全
- ExtJS学习-----------Ext.Object,ExtJS对javascript中的Object的扩展
- awk
- 求逆序数的三种数据结构比较
- STL算法归类
- 安装TortoiseGit 状态图标不能正常显示
- intellij idea常用设置
- 数据结构与算法
- 2010成都站J题 ||hdu 3718 二分图的最佳匹配 =〉 最小费用最大流
- sendBroadcastAsUser——Calling a method in the system process without a qualified user
- LeetCode——4Sum
- Lession 30 异常处理
- php xmlsimpleelement 解析xml