이름공간
변수
행위

Algorithms library

cppreference.com
< cpp
 
 
 

알고리즘 라이브러리는 일정 범위의 요소들에게 적용될 다양한 목적의 함수들을 정의합니다(예를 들면 검색(searching), 정렬(sorting), 갯수세기(counting), 조절하기(manipulating)). [first, last) 처럼 정의된 범위에서 last 가 가리키는 위치의 요소는 값을 확인(inspect)하거나 수정(modify)할 수 있는 마지막 요소를 "지나쳐 벗어난다(past)"라는 것을 유념하기 바랍니다.

목차

Non-modifying sequence operations
<algorithm> 헤더에 정의됨.
(C++11)
(C++11)
(C++11)
지정된 범위의 모든 요소들에 대해서 의문술어가 모두 또는 하나라도 true를 반환하거나 전혀 안하는지 검사하기.
(function template) [edit]
어떤 함수를 한 범위의 요소들에게 적용하기.
(function template) [edit]
returns the number of elements satisfying specific criteria
(function template) [edit]
finds the first position where two ranges differ
(function template) [edit]
determines if two sets of elements are the same
(function template) [edit]
finds the first element satisfying specific criteria
(function template) [edit]
finds the last sequence of elements in a certain range
(function template) [edit]
searches for any one of a set of elements
(function template) [edit]
finds two identical (or some other relationship) items adjacent to each other
(function template) [edit]
searches for a range of elements
(function template) [edit]
searches for a number consecutive copies of an element in a range
(function template) [edit]
Modifying sequence operations
<algorithm> 헤더에 정의됨.
copies a range of elements to a new location
(function template) [edit]
(C++11)
copies a number of elements to a new location
(function template) [edit]
copies a range of elements in backwards order
(function template) [edit]
(C++11)
moves a range of elements to a new location
(function template) [edit]
moves a range of elements to a new location in backwards order
(function template) [edit]
assigns a range of elements a certain value
(function template) [edit]
assigns a value to a number of elements
(function template) [edit]
applies a function to a range of elements
(function template) [edit]
saves the result of a function in a range
(function template) [edit]
saves the result of N applications of a function
(function template) [edit]
removes elements satisfying specific criteria
(function template) [edit]
copies a range of elements omitting those that satisfy specific criteria
(function template) [edit]
replaces all values satisfying specific criteria with another value
(function template) [edit]
copies a range, replacing elements satisfying specific criteria with another value
(function template) [edit]
두 객체의 값을 맞바꿈
(function template) [edit]
swaps two ranges of elements
(function template) [edit]
swaps the elements pointed to by two iterators
(function template) [edit]
reverses the order elements in a range
(function template) [edit]
creates a copy of a range that is reversed
(function template) [edit]
rotates the order of elements in a range
(function template) [edit]
copies and rotate a range of elements
(function template) [edit]
randomly re-orders elements in a range
(function template) [edit]
removes consecutive duplicate elements in a range
(function template) [edit]
creates a copy of some range of elements that contains no consecutive duplicates
(function template) [edit]
Partitioning operations
<algorithm> 헤더에 정의됨.
determines if the range is partitioned by the given predicate
(function template) [edit]
divides a range of elements into two groups
(function template) [edit]
copies a range dividing the elements into two groups
(function template) [edit]
divides elements into two groups while preserving their relative order
(function template) [edit]
locates the partition point of a partitioned range
(function template) [edit]
Sorting operations (on sorted ranges)
<algorithm> 헤더에 정의됨.
(C++11)
checks whether a range is sorted into ascending order
(function template) [edit]
finds the largest sorted subrange
(function template) [edit]
sorts a range into ascending order
(function template) [edit]
sorts the first N elements of a range
(function template) [edit]
copies and partially sorts a range of elements
(function template) [edit]
sorts a range of elements while preserving order between equal elements
(function template) [edit]
partially sorts the given range making sure that it is partitioned by the given element
(function template) [edit]
Binary search operations (on sorted ranges)
<algorithm> 헤더에 정의됨.
returns an iterator to the first element not less than the given value
(function template) [edit]
returns an iterator to the first element greater than a certain value
(function template) [edit]
determines if an element exists in a certain range
(function template) [edit]
returns range of elements matching a specific key
(function template) [edit]
Set operations (on sorted ranges)
<algorithm> 헤더에 정의됨.
merges two sorted ranges
(function template) [edit]
merges two ordered ranges in-place
(function template) [edit]
returns true if one set is a subset of another
(function template) [edit]
computes the difference between two sets
(function template) [edit]
computes the intersection of two sets
(function template) [edit]
computes the symmetric difference between two sets
(function template) [edit]
computes the union of two sets
(function template) [edit]
Heap operations
<algorithm> 헤더에 정의됨.
checks if the given range is a max heap
(function template) [edit]
finds the largest subrange that is a max heap
(function template) [edit]
creates a max heap out of a range of elements
(function template) [edit]
adds an element to a max heap
(function template) [edit]
removes the largest element from a max heap
(function template) [edit]
turns a max heap into a range of elements sorted in ascending order
(function template) [edit]
Minimum/maximum operations
<algorithm> 헤더에 정의됨.
returns the larger of two elements
(function template) [edit]
returns the largest element in a range
(function template) [edit]
returns the smaller of two elements
(function template) [edit]
returns the smallest element in a range
(function template) [edit]
(C++11)
returns the larger and the smaller of two elements
(function template) [edit]
returns the smallest and the largest element in a range
(function template) [edit]
returns true if one range is lexicographically less than another
(function template) [edit]
determines if a sequence is a permutation of another sequence
(function template) [edit]
generates the next greater lexicographic permutation of a range of elements
(function template) [edit]
generates the next smaller lexicographic permutation of a range of elements
(function template) [edit]
Numeric operations
<numeric> 헤더에 정의됨.
(C++11)
fills a range with successive increments of the starting value
(function template) [edit]
sums up a range of elements
(function template) [edit]
computes the inner product of two ranges of elements
(function template) [edit]
computes the differences between adjacent elements in a range
(function template) [edit]
computes the partial sum of a range of elements
(function template) [edit]
C library
<cstdlib> 헤더에 정의됨.
sorts a range of elements with unspecified type
(function) [edit]
searches an array for an element of unspecified type
(function) [edit]