C++ STL Algorithm Library (original) (raw)

Last Updated : 27 May, 2026

Algorithms are ready-made functions that help you perform common operations like searching, sorting, counting, and comparing on containers (like arrays, vectors, sets, etc.). These algorithms are defined in the and header files.

Type of Algorithms

We can divide the algorithms into following parts:

1. Searching Algorithms

Searching algorithms are methods used to find a specific element or information in a data structure like an array, vector, or list.
They help locate an element efficiently without manually checking each item.

Some of the most frequently used searching algorithms are:

2. Sorting and Rearranging Algorithms

These change the order or position of elements.

3. Manipulation Algorithms

These change or update values in the container without necessarily sorting or searching them.

4. Counting & Comparing Algorithms

These check or count elements based on conditions.

5. Functions

Include common functions like: