Skip to content

Tag Archives: cpp-algorithm-library

Compute cumulative inner product of range Returns the result of accumulating init with the inner products of the pairs formed by the elements of two ranges… Read More
Union of two sorted ranges The union of two sets is formed by the elements that are present in either one of the sets, or in… Read More
The difference of two sets is formed by the elements that are present in the first set, but not in the second one. The elements… Read More
The intersection of two sets is formed only by the elements that are present in both sets. The elements copied by the function come always… Read More
Basics of Binary Search std::bsearch searches for an element in a sorted array. Finds an element equal to element pointed to by key in an… Read More
Clamps a variable to a given range[high – low]. If num > high, num is assigned high. If num < low, num is assigned low.… Read More
std::partial_sort is used for sorting the range within the entire container. So, if we want to keep the original container intact and just copy the… Read More
std::sort is used for sorting the elements present within a container. One of the variants of this is std::partial_sort, which is used for sorting not… Read More
std::is_partitioned is used for finding whether the range[first, last) is partitioned or not. A range is said to be partitioned with respect to a condition… Read More
std::swap is used for swapping of elements between two containers. One of the other way of doing this same thing is facilitated by std::iter_swap, which… Read More
std::equal_range is used to find the sub-range within a given range [first, last) that has all the elements equivalent to a given value. It returns… Read More
std::find_end is used to find the last occurrence of a sub-sequence inside a container. It searches the range [first1,last1) for the last occurrence of the… Read More
std::find_first_of is used to compare elements between two containers. It compares all the elements in a range [first1,last1) with the elements in the range [first2,last2),… Read More
std::unique is used to remove duplicates of any element present consecutively in a range[first, last). It performs this task for all the sub-groups present in… Read More
std::unique is used to remove duplicates of any element present consecutively in a range[first, last). It performs this task for all the sub-groups present in… Read More