[C++] <algorithm> 라이브러리 속 유용한 함수
1) #include 원소들에 대해 작업할 수 있는 여러가지 함수들을 정의하고 있는 라이브러리. 2) 주요 함수 count(begin, end, value) : [begin, end] 에 포함되어 있는 원소 중에서 value의 개수를 찾는다. count_if (begin, end, p) : [begin, end] 에 포함되어 있는 원소 중에서 조건 p에 해당하는 value의 개수를 찾는다. # begin, end = iterator # p = 함수 pointer # 시간복잡도 : O(N) bool is_big(int x) { return (x > 2); } int main() { vector v = {1, 4, 1, 2, 4, 2, 4, 2, 4, 3, 4, 4}; for(int i = 1; i