SlideShare a Scribd company logo
5
Most read
6
Most read
7
Most read
Algorithm Paradigms

By
G Suresh Babu
Algorithm

An algorithm is a step-by-step procedure for
solving a problem.
Paradigm
“Pattern of thought” which governs scientific
apprehension during a certain period of time
Paradigms for Algorithm Design
To aid in designing algorithms for new problems, we
create a taxonomy of high level patterns or
paradigms, for the purpose of structuring a new
algorithm along the lines of one of these paradigms.
A paradigm can be viewed as a very high level
algorithm for solving a class of problems
Various algorithm Paradigms
Brute force paradigm
Divide and conquer paradigm
Backtracking paradigm
Greedy paradigm
Dynamic programming paradigm
Brute force paradigm
Brute force is one of the easiest and straight forward
approach to solve a problem
Based on trying all possible solutions

It is useful for solving small–size instances of a
problem
Generally most expensive approach
Examples: Sequential search, factors of number
Divide and conquer paradigm
 Based on dividing problem into sub problems
Approach
1. Divide problem into smaller sub problems
 Sub problems must be of same type
 Sub problems do not need to overlap
2. Solve each sub problem recursively
3. Combine solutions to solve original problem
Examples : Merge Sort, Quick Sort.
Backtracking paradigm
 Backtracking is a technique used to solve problems
with a large search space, by systematically trying
and eliminating possibilities

Based on depth-first recursive search
Examples : Find path through maze, eight queens
problem
Finding Path through maze

Path A

Path B
Eight Queens Problem
Find an arrangement of 8 queens
on a single chess board such that
no two queens are attacking one
another.
1) Place a queen on the first
available square in row 1.
2) Move onto the next row,
placing a queen on the first
available square there (that
doesn't conflict with the
previously placed queens).
Greedy paradigm
Optimal solution :A solution which minimizes or
maximizes objective function is called optimal solution
(i.e. BEST solution)
This technique suggest devising an algorithm in no of
steps, each stage depends on a particular input which
gives “optimal solution”.

Examples : 0/1 knapsack, kruskals & prims, counting
money, Dijkstra’s shortest path algorithm
Counting money
Suppose you want to count certain amount of money, using
the fewest possible bills and coins
A greedy algorithm to do this would be:
1. At each step, take the largest possible bill or coin that does
not overshoot
Example: To make 17Rs from 1,5,10 rupee denominations
a)add 10 rupee note
b)add 5 rupee note
c)add two 1 rupee notes
Dynamic programming paradigm
It is also an optimization technique.
Based on remembering past results
Approach
a) Divide problem into smaller sub problems
Sub problems must be of same type
Sub problems must overlap
b)Solve each sub problem recursively
May simply look up solution
c)Combine solutions into to solve original problem
Store solution to problem

Examples: All pairs shortest path, Fibonacci series
Fibonacci series
Fibonacci numbers
– Fibonacci(0) = 1
– Fibonacci(1) = 1
– Fibonacci(n) = Fibonacci(n-1) + Fibonacci(n-2)
Recursive algorithm to calculate Fibonacci(n)
– If n is 0 or 1, return 1
– Else compute Fibonacci(n-1) and Fibonacci(n-2)
– Return their sum
Dynamic programming comes to rescue!
Each computation stores the result in memory for future references.

Instead of calling Fib(n-1) and Fib(n-2) we are first checking if they
are already present in memory or not.
Summary
Wide range of strategies
Choice depends on
 Properties of problem
 Expected problem size
 Available resources
Any queries ???
Thank you

More Related Content

What's hot (20)

PPTX
Problem solving in Artificial Intelligence.pptx
kitsenthilkumarcse
 
PPTX
Types of algorithms
Amelita Martinez
 
PPTX
Deadlock Prevention
prachi mewara
 
PPTX
Leaky Bucket & Tocken Bucket - Traffic shaping
Vimal Dewangan
 
PPTX
Daa unit 1
Abhimanyu Mishra
 
PPTX
Question answer
vishal choudhary
 
PPT
Greedy Algorihm
Muhammad Amjad Rana
 
PPTX
3.5 equivalence of pushdown automata and cfl
Sampath Kumar S
 
PPTX
heap Sort Algorithm
Lemia Algmri
 
PPT
Np cooks theorem
Narayana Galla
 
PPT
Backtracking
Vikas Sharma
 
PPTX
Divide and conquer - Quick sort
Madhu Bala
 
PPTX
Travelling salesman dynamic programming
maharajdey
 
DOC
Chapter 4 (final)
Nateshwar Kamlesh
 
PPTX
Job sequencing with Deadlines
YashiUpadhyay3
 
PPTX
Mathematical Analysis of Non-Recursive Algorithm.
mohanrathod18
 
PDF
Informed search
Amit Kumar Rathi
 
PPTX
N queen problem
Ridhima Chowdhury
 
PPTX
knowledge representation using rules
Harini Balamurugan
 
Problem solving in Artificial Intelligence.pptx
kitsenthilkumarcse
 
Types of algorithms
Amelita Martinez
 
Deadlock Prevention
prachi mewara
 
Leaky Bucket & Tocken Bucket - Traffic shaping
Vimal Dewangan
 
Daa unit 1
Abhimanyu Mishra
 
Question answer
vishal choudhary
 
Greedy Algorihm
Muhammad Amjad Rana
 
3.5 equivalence of pushdown automata and cfl
Sampath Kumar S
 
heap Sort Algorithm
Lemia Algmri
 
Np cooks theorem
Narayana Galla
 
Backtracking
Vikas Sharma
 
Divide and conquer - Quick sort
Madhu Bala
 
Travelling salesman dynamic programming
maharajdey
 
Chapter 4 (final)
Nateshwar Kamlesh
 
Job sequencing with Deadlines
YashiUpadhyay3
 
Mathematical Analysis of Non-Recursive Algorithm.
mohanrathod18
 
Informed search
Amit Kumar Rathi
 
N queen problem
Ridhima Chowdhury
 
knowledge representation using rules
Harini Balamurugan
 

Viewers also liked (10)

PPTX
3d password by suresh
suresh5c2
 
PPT
3d password ppt
Gowsalyasri
 
PPT
Design Patterns
ppd1961
 
PPT
9781439035665 ppt ch05
Terry Yoast
 
PPTX
3d passwords
shwetaag
 
PPT
Time complexity
Katang Isip
 
PPT
3D Password
Zishan Mohsin
 
PPTX
3d password ppt
manisha0902
 
DOCX
Vlsi physical design-notes
Dr.YNM
 
PDF
3D Password PPT
Seminar Links
 
3d password by suresh
suresh5c2
 
3d password ppt
Gowsalyasri
 
Design Patterns
ppd1961
 
9781439035665 ppt ch05
Terry Yoast
 
3d passwords
shwetaag
 
Time complexity
Katang Isip
 
3D Password
Zishan Mohsin
 
3d password ppt
manisha0902
 
Vlsi physical design-notes
Dr.YNM
 
3D Password PPT
Seminar Links
 
Ad

Similar to Algorithm paradigms (20)

PPTX
esign and Analysis of Algorithms Presentation.pptx
Niraj759370
 
PPTX
Applied Algorithms Introduction to Algorithms.pptx
nishankarsathiyamoha
 
PPTX
Algorithms Design Patterns
Ashwin Shiv
 
PPT
csce411-set7.ppt
JoshCasas1
 
PPTX
Our presentation on algorithm design
Nahid Hasan
 
PDF
Data Analysis and Algorithms Lecture 1: Introduction
TayyabSattar5
 
PDF
Analysis and Design of Algorithms notes
Prof. Dr. K. Adisesha
 
PDF
DAA INTRO.pdf of design analysis algorithms
VaishnaviDappu
 
PPTX
Architecture Algorithm Definition
Gaditek
 
PPTX
Greedy algorithm for design and analysis
JavedKhan524377
 
PPT
Algorithm designs and its technique.ppt
AnchalaSharma4
 
PPT
ADT(Algorithm Design Technique Backtracking algorithm).ppt
AnchalaSharma4
 
PPSX
Ic lecture6 architecture and algo
AttaullahRahimoon
 
PPTX
data structure and algorithm (Advanced algorithm Stretegies)
shahghanikhan
 
PPT
35 algorithm-types
ashish bansal
 
PPT
algorithm-types.ppt
TusharSharma759024
 
PPT
35-algorithm-types.ppt
HarikumarRajandran1
 
PPT
35 algorithm-types
EducationalJunction
 
PDF
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
MAJDABDALLAH3
 
PPTX
Design and Analysis of Algorithm-Lecture.pptx
bani30122004
 
esign and Analysis of Algorithms Presentation.pptx
Niraj759370
 
Applied Algorithms Introduction to Algorithms.pptx
nishankarsathiyamoha
 
Algorithms Design Patterns
Ashwin Shiv
 
csce411-set7.ppt
JoshCasas1
 
Our presentation on algorithm design
Nahid Hasan
 
Data Analysis and Algorithms Lecture 1: Introduction
TayyabSattar5
 
Analysis and Design of Algorithms notes
Prof. Dr. K. Adisesha
 
DAA INTRO.pdf of design analysis algorithms
VaishnaviDappu
 
Architecture Algorithm Definition
Gaditek
 
Greedy algorithm for design and analysis
JavedKhan524377
 
Algorithm designs and its technique.ppt
AnchalaSharma4
 
ADT(Algorithm Design Technique Backtracking algorithm).ppt
AnchalaSharma4
 
Ic lecture6 architecture and algo
AttaullahRahimoon
 
data structure and algorithm (Advanced algorithm Stretegies)
shahghanikhan
 
35 algorithm-types
ashish bansal
 
algorithm-types.ppt
TusharSharma759024
 
35-algorithm-types.ppt
HarikumarRajandran1
 
35 algorithm-types
EducationalJunction
 
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
MAJDABDALLAH3
 
Design and Analysis of Algorithm-Lecture.pptx
bani30122004
 
Ad

Recently uploaded (20)

PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 

Algorithm paradigms

  • 2. Algorithm An algorithm is a step-by-step procedure for solving a problem. Paradigm “Pattern of thought” which governs scientific apprehension during a certain period of time
  • 3. Paradigms for Algorithm Design To aid in designing algorithms for new problems, we create a taxonomy of high level patterns or paradigms, for the purpose of structuring a new algorithm along the lines of one of these paradigms. A paradigm can be viewed as a very high level algorithm for solving a class of problems
  • 4. Various algorithm Paradigms Brute force paradigm Divide and conquer paradigm Backtracking paradigm Greedy paradigm Dynamic programming paradigm
  • 5. Brute force paradigm Brute force is one of the easiest and straight forward approach to solve a problem Based on trying all possible solutions It is useful for solving small–size instances of a problem Generally most expensive approach Examples: Sequential search, factors of number
  • 6. Divide and conquer paradigm  Based on dividing problem into sub problems Approach 1. Divide problem into smaller sub problems  Sub problems must be of same type  Sub problems do not need to overlap 2. Solve each sub problem recursively 3. Combine solutions to solve original problem Examples : Merge Sort, Quick Sort.
  • 7. Backtracking paradigm  Backtracking is a technique used to solve problems with a large search space, by systematically trying and eliminating possibilities Based on depth-first recursive search Examples : Find path through maze, eight queens problem
  • 8. Finding Path through maze Path A Path B
  • 9. Eight Queens Problem Find an arrangement of 8 queens on a single chess board such that no two queens are attacking one another. 1) Place a queen on the first available square in row 1. 2) Move onto the next row, placing a queen on the first available square there (that doesn't conflict with the previously placed queens).
  • 10. Greedy paradigm Optimal solution :A solution which minimizes or maximizes objective function is called optimal solution (i.e. BEST solution) This technique suggest devising an algorithm in no of steps, each stage depends on a particular input which gives “optimal solution”. Examples : 0/1 knapsack, kruskals & prims, counting money, Dijkstra’s shortest path algorithm
  • 11. Counting money Suppose you want to count certain amount of money, using the fewest possible bills and coins A greedy algorithm to do this would be: 1. At each step, take the largest possible bill or coin that does not overshoot Example: To make 17Rs from 1,5,10 rupee denominations a)add 10 rupee note b)add 5 rupee note c)add two 1 rupee notes
  • 12. Dynamic programming paradigm It is also an optimization technique. Based on remembering past results Approach a) Divide problem into smaller sub problems Sub problems must be of same type Sub problems must overlap b)Solve each sub problem recursively May simply look up solution c)Combine solutions into to solve original problem Store solution to problem Examples: All pairs shortest path, Fibonacci series
  • 13. Fibonacci series Fibonacci numbers – Fibonacci(0) = 1 – Fibonacci(1) = 1 – Fibonacci(n) = Fibonacci(n-1) + Fibonacci(n-2) Recursive algorithm to calculate Fibonacci(n) – If n is 0 or 1, return 1 – Else compute Fibonacci(n-1) and Fibonacci(n-2) – Return their sum
  • 14. Dynamic programming comes to rescue! Each computation stores the result in memory for future references. Instead of calling Fib(n-1) and Fib(n-2) we are first checking if they are already present in memory or not.
  • 15. Summary Wide range of strategies Choice depends on  Properties of problem  Expected problem size  Available resources Any queries ???