Algorithms

Hi Im pretty new to c++ and im still in the basics,but I've been seeing a lot of texts on algorithms in programming and was wondering at what level I can get into them. What are they used for stuff like that. Please explain and if there are very basic ones I could use that would be great thank you for all answers. And Im learning c++.
Last edited on
You should start using them the moment you understand how to make function calls. std::count is one of the simpler ones. It simply counts the occurrences of a particular value within the range specified using two iterators. Read the documentation on std::count and you'll see how easy it is to use.
Or are you asking about the algorithms in the general sense?

In the broadest sense an algorithm is simply a series of steps used to solve a problem. For example, a simple algorithm for making a chocolate cake is:

1. Gather ingredients
2. Mix ingredients
3. Bake

In this sense, every program you write has some semblance of an algorithm to it. Having said that, there are some problems that occur so frequently that there are published algorithms for them. For example, sorting, or as kempofighter mentioned, counting the number of elements in a data structure that match a set of criteria.

Topic archived. No new replies allowed.