First of all, it's helpful to agree on the term
Algorithm[
^]:
[...] In mathematics and computer science, an algorithm [...] is a step-by-step procedure for calculations. [...]
There are various angles to look at your question.
If it's about your skills to implement an existing step-by-step description in a given language (e.g. C++), then you need first the understanding of the problem domain and its formalism and then have the practical experience to write and test the program for it. E.g. take
Regula Falsi[
^], or
FFT (and it's implementation in C++)[
^], etc.
- Understand the problem domain.
- Master it's formalism.
- Deduce from the formalism some step-by-step procedure to calculate values.
- Gain experience to implement the step-by-step description into a given computer language.
Another angle to view this question is: how to produce for a given problem a step-by-step procedure to calculate values without having a formalism at hand. E.g. problems like "trim a string", "write a fixed-point arithmetic for add/sub/mul/div/rem/sin/cos for a given number range and precision", etc.
- Understand the problem domain.
- Invent a formalism (a way to describe the problem and possible solution, e.g. in pseudo code) and experiment with it.
- Deduce from the formalism some step-by-step procedure to calculate values.
- Gain experience to implement the step-by-step description into a given computer language.
You see that a good part is common to both cases.
You need to acquire knowledge on
discrete mathematics since you have to know about the limits of computer arithmetics. You need to acquire knowledge about
complexity theory since you have to know how to estimate the complexity of a calculation (e.g. execution time, memory foot print, etc.).
In any case, beside a good portion of enthusiasm, you need to exercise - again and again. Start with the first approach to "implement" existing algorithms. Chose a topic you are interested in, e.g. directed graphs (there are many books about it), or pattern match (regular expressions), trigonometric series like sin(x) = x - x
3/3! + x
5/5! - x
7/7! ... (any Math book), etc. and implement some of the algorithms.
Gain experience and learn as you go...
Cheers
Andi