Algorithm Design Techniques
Algorithm Design Techniques
TECHNIQUES
DR. PAUL AAZAGREYIR
Lecture Objective
By the end of this Lecture, students will be able to;
Explain Algorithm Design Techniques and Popular Algorithm Design
Techniques with examples (Divide-and-Conquer Approach, Greedy
Techniques, Dynamic Programming and Branch and Bound.
Divide-and-Conquer Approach
Greedy Techniques
Dynamic Programming
Backtracking Algorithm
Randomized Algorithm
Algorithm Design Techniques
An algorithm design technique (or “strategy” or “paradigm”) is a
general approach to solving problems algorithmically that is applicable
to a variety of problems from different areas of computing.
REASONS
First, they provide guidance for designing algorithms for new problems, i.e.,
problems for which there is no known satisfactory algorithm.
Algorithm design techniques make it possible to classify algorithms
according to an underlying design idea; therefore, they can serve as a natural
way to both categorize and study algorithms.
Popular Algorithm Design Techniques
1. Divide and Conquer Approach:
The divide-and-conquer paradigm often helps in the discovery of
efficient algorithms. It is a top-down approach.
Combine the solution of the sub-problems (top level) into a solution of the whole original
problem.
DIVIDE AND CONQUER APPROACH
CONTINUOUS
STANDARD VARIETIES OF DIVIDE AND CONQUER TECHNIQUES
So the problems where choosing locally optimal also leads to global solution are best fit for
Greedy.
An optimization problem is one in which we are given a set of input values, which are
required either to be maximized or minimized (known as objectives).
GREEDY TECHNIQUES CONTINUOUS
SOME CONSTRAINTS OR CONDITIONS
Greedy algorithm always makes the choice (greedy criteria) looks best at the moment, to
optimize a given objective.
The greedy algorithm doesn't always guarantee the optimal solution however it generally
produces a solution that is very close in value to the optimal.
Fibonacci sequence
It is used for solving the optimization problems and minimization problems. If we have
given a maximization problem then we can convert it using the Branch and bound
technique by simply converting the problem into a maximization problem.
Branch and bound is an algorithm design paradigm which is generally used for solving
combinatorial optimization problems.
BRANCH AND BOND CONTINUOUS
Some examples of Branch-and-Bound Problems are:
Knapsack problems
solutions backtrack(expand s)
It finds a solution by building a solution step by step, increasing levels over time,
using recursive calling. A search tree known as the state-space tree is used to
find these solutions.
BACKTRACKING ALGORITHMS CONTINUOUS
A backtracking algorithm uses the depth-first search method. When the algorithm begins
to explore the solutions, the abounding function is applied so that the algorithm can
determine whether the proposed solution satisfies the constraints.
In any backtracking algorithm, the algorithm seeks a path to a feasible solution that
includes some intermediate checkpoints. If the checkpoints do not lead to a viable
solution, the problem can return to the checkpoints and take another path to find a
solution.
Scenarios In Using The Backtracking.
It is used to solve a variety of problems. You can use it, for example, to find a feasible
solution to a decision problem.
Backtracking algorithms were also discovered to be very effective for solving optimization
problems.
In some cases, it is used to find all feasible solutions to the enumeration problem.
BACKTRACKING ALGORITHMS
CONTINUOUS
Backtracking, on the other hand, is not regarded as an optimal problem-solving technique.
It is useful when the solution to a problem does not have a time limit.
Backtracking algorithms are used in;
Finding all Hamiltonian paths present in a graph
Solving the N-Queen problem
Knights Tour problem, etc
Randomized Algorithm
A randomized algorithm is an algorithm that employs a degree of randomness as part of its
logic or procedure. ... In some cases, probabilistic algorithms are the only practical means of
solving a problem.
The output of a randomized algorithm on a given input is a random variable. Thus, there
may be a positive probability that the outcome is incorrect. As long as the probability of
error is small for every possible input to the algorithm, this is not a problem.
There are two main types of randomized algorithms: Las Vegas algorithms and Monte-
Carlo algorithms.