Algorithm Design Refers To A Method or A Mathematical Process For Problem
Algorithm Design Refers To A Method or A Mathematical Process For Problem
algorithms. The design of algorithms is part of many solution theories, such as divide-and-
conquer or dynamic programming within operation research. Techniques for designing and
implementing algorithm designs are also called algorithm design patterns, [42] with examples including
the template method pattern and the decorator pattern.
One of the most important aspects of algorithm design is resource (run-time, memory usage)
efficiency; the big O notation is used to describe e.g. an algorithm's run-time growth as the size of its
input increases.
Typical steps in the development of algorithms:
1. Problem definition
2. Development of a model
3. Specification of the algorithm
4. Designing an algorithm
5. Checking the correctness of the algorithm
6. Analysis of algorithm
7. Implementation of algorithm
8. Program testing
9. Documentation preparation
One very important aspect of problem-solving is devising good strategies. Indeed there are many
strategies for algorithm design. This post elaborates more on just a few of them.
The outline of this post is based somewhat on the third chapter of the book Computer Science
Distilled [1]. As noted earlier, there are many strategies for algorithm design. A quick run-through
Iteration
Recursion
Brute force
Backtracking
Greedy Method (Heuristics)
Divide and Conquer
Dynamic Programming
Branch and Bound
Two Pointer
Sliding Window
force and backtracking.
computational problem.
A strategy might yield incorrect results, but a correct algorithm will always produce
correct results.
Strategies are invented, algorithms are more or less tested and trusted standards
Strategies are flexible, but algorithms are rigid i.e. they follow only one set of
procedures
1. Iteration
Iteration involves repeating a block of code until a condition is false. During iteration, the program
Iteration can be achieved using loops or recursion (more on this later). The basic loop constructs
are:
The for loop
The for-each loop
The while loop
The do-while loop
and reduce functions.
2. Recursion
Recursion is repetition achieved through method calls. A recursive method makes repeated calls
to itself before returning a result. A result is returned if and only if a base case exists.
This base case ensures that the solution converges otherwise an infinite recursion occurs which
Recursion is intuitive because each new method call works on clones of the original problem