Science, Tech, Math › Computer Science The Definition of a C++ Algorithm Algorithms solve problems and provide functionality Share Flipboard Email Print Serkan Ismail / EyeEm / Getty Images Computer Science C & C++ Programming PHP Programming Perl Python Java Programming Javascript Programming Delphi Programming Ruby Programming Visual Basic View More By David Bolton David Bolton Computer Science Expert B.A., Computer Science, Queen's University Belfast David Bolton is a software developer who has worked for several major firms, including Morgan Stanley, PwC, BAE Systems, and LCH. Learn about our Editorial Process Updated on March 03, 2019 In general, an algorithm is a description of a procedure that terminates with a result. For example, the factorial of a number x is x multiplied by x-1 multiplied by x-2 and so on until it is multiplied by 1. The factorial of 6 is 6! = 6 x 5 x 4 x 3 x 2 x 1=720. This is an algorithm that follows a set procedure and terminates in a result. In computer science and programming, an algorithm is a set of steps used by a program to accomplish a task. Once you learn about algorithms in C++, you can use them in your programming to save yourself time and to make your programs run faster. New algorithms are being designed all the time, but you can start with the algorithms that have proven to be reliable in the C++ programming language. Algorithms in C++ In C++, the designation identifies a group of functions that run on a designated range of elements. The algorithms are used to solve problems or provide functionality. Algorithms work exclusively on values; they don't affect the size or storage of a container. Simple algorithms can be implemented within a function. Complex algorithms might require several functions or even a class to implement them. Classifications and Examples of Algorithms in C++ Some algorithms in C++, such as find-if, search, and count are sequence operations that don't make changes, while remove, reverse, and replace are algorithms that modify operations. The classifications of algorithms with a few examples are: Non-modifying sequence modifications (find-if, equal, all_of)Modifying sequence operations (copy, remove, transform)Sorting (sort, partial sort, nth_element)Binary Search (lower_bound, upper_bound)Partitions (partition, partition_copy)Merge (includes, set_intersection, merge)Heap (make_heap, push_heap) Min/max (min, max,min_element) A list of the most common C++ algorithms and example code for many of them are available online in C++ documentation and on user websites. Cite this Article Format mla apa chicago Your Citation Bolton, David. "The Definition of a C++ Algorithm." ThoughtCo, Aug. 27, 2020, thoughtco.com/definition-of-algorithm-p2-958013. Bolton, David. (2020, August 27). The Definition of a C++ Algorithm. Retrieved from https://www.thoughtco.com/definition-of-algorithm-p2-958013 Bolton, David. "The Definition of a C++ Algorithm." ThoughtCo. https://www.thoughtco.com/definition-of-algorithm-p2-958013 (accessed April 2, 2023). copy citation Featured Video