Design and Analysis of Algorithms
Design and Analysis of Algorithms
OF ALGORITHMS
ALGORITHMIC TECHNIQUES
ALGORITHMIC TECHNIQUES
• Divide and Conquer
• Brute Force
• Greedy Technique
• Dynamic Programming
• Decrease and Conquer
• Backtracking
• Branch and Bond
ALGORITHMIC TECHNIQUES
• Divide and Conquer
• The Divide and Conquer strategy involves dividing the problem into
sub-problem, recursively solving them, and then recombining them
for the final answer.
• E.g. Merge sort,Quick sort, Binary search ,Defective Chess Board
• Brute force Attack
• Solving the problem based on problem statement definition
• E.g selection sort,Bubble sort, sequential search, Pattern matching
ALGORITHMIC TECHNIQUES
• Dynamic Programming
• Solving a problem with overlapping subproblems
• Dynamic Programming is a bottom-up approach we solve all possible
small problems and then combine them to obtain solutions for bigger
problems.
• E.g. Warshall’s Algorithm, Floyd’s Algorithm,Travelling salesman
Problem,Knapsack Problem
ALGORITHMIC TECHNIQUES
• Greedy
• Greedy method is used to solve the optimization problem.
• 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 objective),
i.e. 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.
• E.g Knapsack Problem,Job Sequencingwith deadline,Dijktra’s Algorithm,
Prim’s Algorithm and Kruskal Algorithm
ALGORITHMIC TECHNIQUES
• Branch and Bound
• Systematically searching for a solution in state space
• In Branch & Bound algorithm a given subproblem, which cannot be
bounded, has to be divided into at least two new restricted subproblems.
• Branch and Bound algorithm are methods for global optimization in non-
convex problems.
• Branch and Bound algorithms can be slow, however in the worst case they
require effort that grows exponentially with problem size, but in some cases
we are lucky, and the method coverage with much less effort.
• E.g Knapsack Problem, Travelling Salesman Problem, Assignment Problem
ALGORITHMIC TECHNIQUES
• Backtracking
• Backtracking Algorithm tries each possibility until they find the right
one.
• It is a depth-first search of the set of possible solution.
• During the search, if an alternative doesn't work, then backtrack to the
choice point, the place which presented different alternatives, and tries
the next alternative.
• N-Queens Problem, Hamiltonian Circuit, Knapsack Problem
Sorting Algorithms
• A Sorting Algorithm is used to rearrange a given array or list of
elements according to a comparison operator on the elements. The
comparison operator is used to decide the new order of elements in the
respective data structure.
• Quick sort
• Selection sort
• Bubble sort
Selection sort