Tag Archives: cpp-algorithm-library

Given two arrays, the task is that we find numbers which are present in first array, but not present in the second array, using STL… Read More
The lower_bound() and upper_bound() functions, by default works on non-decreasing array. The lower_bound() function finds iterator of first element that does not compare less to… Read More
The for_each_n() function was added in the C++17 technical specification. Its idea has been borrowed from the use of map in Python or Haskel. This… Read More
remove_copy() It is an STL function in c++ which is defined in algorithm library. It copies the elements in the range [first, last) to the… Read More
Non-modifying sequence operations  std :: all_of  : Test condition on all elements in range std :: any_of  : Test if any element in range fulfills… Read More
std::next_permutation It is used to rearrange the elements in the range [first, last) into the next lexicographically greater permutation. A permutation is each one of… Read More
partition_point() Gets the partition point : Returns an iterator to the first element in the partitioned range [first, last) for which pred(predicate) is not true,… Read More
The sort_heap( ) is an STL algorithm which sorts a heap within the range specified by start and end. Sorts the elements in the heap… Read More
The stable_partition( ) algorithm arranges the sequence defined by start and end such that all elements for which the predicate specified by pfn returns true… Read More
random_shuffle It randomly rearrange elements in range [first, last). The function swaps the value of each element with some other randomly picked element. When provided,… Read More
Returns true if pred returns false for all the elements in the range [first, last] or if the range is empty, and false otherwise.Syntax : … Read More
C++ offers in its STL library a merge() which is quite useful to merge sort two containers into a single container. It is defined in… Read More
C++ defines a function which can be used to recognise if all the numbers in a container, also exists in other container. This task can… Read More
Symmetric difference of two sorted ranges The symmetric difference of two sets is formed by the elements that are present in one of the sets,… Read More
C++ STL offer many utilities to solve basic common life problems. Comparing values are always necessary, but sometimes we need to compare the strings also.… Read More