## Introduction to algorithm

The **algorithm** library provides several functions that can be used for a variety of purposes, for instance searching, sorting, counting, manipulating and so on. These functions operate on ranges of elements and the range is defined as *[first, last)*.

## Functions from <algorithm>

Below is list of all methods from <algorithm> header.

### Member functions

Sr.No. | Method & Description |
---|---|

1 |
Finds the first occurrence of two consecutive elements that are identical and returns an iterator pointing to the first element if identical element exists consecutively otherwise returns an iterator pointing to the last element. |

2 |
Finds the first occurrence of two consecutive elements that are identical and returns an iterator pointing to the first element if identical element exists consecutively otherwise returns an iterator pointing to the last element. |

3 |
Returns true if |

4 |
Returns true if |

5 |
Tests whether value exists in sorted sequence or not. |

6 |
Tests whether value exists in sorted sequence or not. |

7 |
Copies a range of elements to a new location. |

8 |
Copies a range of elements to a new location in backward order. |

9 |
Copies a range of elements to a new location if predicate returns true for value. |

10 |
Copies first |

11 |
Returns the number of occurrences of value in range. |

12 |
Returns the number of occurrences of value from range that satisfies condition. |

13 |
Tests whether two sets of element are equal or not. |

14 |
Tests whether two sets of element are equal or not. |

15 |
Returns a range of element that matches specific key. |

16 |
Returns a range of element that matches specific key. |

17 |
Assigns certain value to a range of elements. |

18 |
Assigns value to the first n elements of the sequence pointed by |

19 |
Assigns value to the first n elements of the sequence pointed by |

20 |
Finds the first occurrence of the element. |

21 |
Finds the last occurrence of the element. |

22 |
Finds the last occurrence of the element. |

23 |
Returns an iterator to the first element in the range of |

24 |
Returns an iterator to the first element in the range of |

25 |
Finds the first occurrence of the element that satisfies the condition. |

26 |
Finds the last occurrence of the element that satisfies the condition. |

27 |
Applies provided function on each element of the range. |

28 |
Assigns the value returned by successive calls to |

29 |
Assigns the value returned by successive calls to |

30 |
Assigns the value returned by successive calls to |

31 |
Test whether first set is subset of another or not. |

32 |
Test whether first set is subset of another or not. |

33 |
Merges two sorted sequence in-place. |

34 |
Merges two sorted sequence in-place. |

35 |
Tests whether given sequence is max heap or not. |

36 |
Tests whether given sequence is max heap or not. |

37 |
Finds the first element from the sequence which violates the max heap condition. |

38 |
Finds the first element from the sequence which violates the max heap condition. |

39 |
Tests whether range is partitioned or not. |

40 |
Tests whether a sequence is permutation of other or not. |

41 |
Tests whether a sequence is permutation of other or not. |

42 |
Tests whether range is sorted or not. |

43 |
Tests whether range is sorted or not. |

44 |
Finds first unsorted element from the sequence. |

45 |
Finds first unsorted element from the sequence. |

46 |
Exchange values of objects pointed by two iterators. |

47 |
Tests whether one range is lexicographically less than another or not. |

48 |
Tests whether one range is lexicographically less than another or not. |

49 |
Finds the first element not less than the given value. |

50 |
Finds the first element not less than the given value. |