C++/STL Algorithms

The STL contains functions for common algorithms within C++.

find
Finds a value within a range.

Example:

copy
Copies a range of elements.

copy_backward reverses the order of elements.

swap
Swaps two sets.

iter_swap
Swaps two elements pointed to by iterators. Main { Int: 12 7 Pritnf(Enter the two Swaps number); Sacnf; { If     For (i=2;i=>0;i++) Printf( Enter two number) }   {      For (j=1;J>0;J+++) } Printf(max number ) Getch; }
 * 1) Include
 * 2) include

transform
Applies a function to a range.

random_shuffle
Randomly shuffles a range.

sort
Sorts elements in a range.

A  retains the original order of equal elements. A  does not provide any advantage over a simple sort of, say, a list of integer values (if the list contains multiple values of "2", it doesn't matter which "2" comes first). However, consider the example of sorting a list of  objects by their first name only. Two different employees may share the same first name (which gives them the ordering relative to the rest of the list). If "Bob Smith" was before to "Bob Jones" in the list prior to the sort, then  would guarantee Smith was before Jones in the sorted list;   does not make such a guarantee. The  algorithm is marginally less efficient due to added constraint.

binary_search
Searches a sorted range for a value.

next_permutation
Transforms a range to the next permutation.

Reversed by.