SlideShare a Scribd company logo
1 of 13
UCSE010 - DESIGN AND ANALYSIS OF ALGORITHMS
1
Dr.Nisha Soms/SRIT
Semester-06/2020-2021
 Many useful algorithms are recursive in
nature.
 To solve a given problem, they call themselves
recursively one or more times.
 These algorithms typically follow a divide &
Conquer approach.
Semester-06/2020-2021 Dr.Nisha Soms/SRIT 2
 Step 1:
 Divide the given big problem into a number of sub-problems that are
similar to the original problem but smaller in size. A sub-problem may
be further divided into its sub-problems. A Boundary stage reaches
when either a direct solution of a sub-problem at some stage is
available or it is not further sub-divided. When no further sub-division
is possible, we have a direct solution for the sub-problem.
 Step 2:
 Conquer (Solve) each solutions of each sub-problem (independently)
by recursive calls; and then
 Step 3:
 Combine the solutions of each sub-problems to generate the solutions
of original problem.
3
Dr.Nisha Soms/SRIT
4
Dr.Nisha Soms/SRIT
Ref: https://medium.com/codex/divide-and-conquer-
algorithm-f766640ef038
 Any algorithms which follow the divide-and-conquer
strategy have the following recurrence form:
5
Dr.Nisha Soms/SRIT
 Where
 T(n) = running time of a problem of size n
 a means “In how many part the problem is divided”
 aT(n/b) means “Time required to solve a sub-problem each of size (n/b)”
 If the problem size is small enough (say, n ≤ c for some constant c), we have
a base case. The brute-force (or direct) solution takes constant time: Θ(1)
 D(n) is the cost(or time) of dividing the problem of size n.
 C(n) is the cost (or time) to combine the sub-solutions.
6
Dr.Nisha Soms/SRIT
 Merge sort
 Quick sort
 Binary search
 Multiplication of Large Integers
 Strassen’s Matrix Multiplication
 Closest-Pair
 Convex-Hull Problems.
Semester-06/2020-2021 Dr.Nisha Soms/SRIT 7
 An analysis theorem that can be used to solve the time
complexity of recurrence relations of the form:
T(n) = aT(n/b) + f(n)
 If a ≥ 1 and b > 1 are constants and f(n) is an
asymptotically positive function, then the Time
complexity of a recursive relation T(n) has the
following asymptotic bounds:
 Case 1: If f(n) = O(nlog
b
a-ϵ), then T(n) = Θ(nlog
b
a).
 Case 2: If f(n) = Θ(nlog
b
a), then T(n) = Θ(nlog
b
a * log n).
 Case 3: If f(n) = Ω(nlog
b
a+ϵ), then T(n) = Θ(f(n)).
Where ϵ > 0 is a constant.
Semester-06/2020-2021 Dr.Nisha Soms/SRIT 8
Consider T(n) = 4T(n/2) + n
Semester-06/2020-2021 Dr.Nisha Soms/SRIT 9
•The given recurrence equation is of the form T(n) = a T(n/b) + f(n), Hence
Master theorem can be applied to perform analysis.
•Here, a = 4, b = 2, and f(n) = n respectively.
•Next, We calculate nlog
b
a from the given recurrence which is nlog
2
4 , that is n2
•The f(n) = n of the given recurrence is less when compared with the calculated
n2
•Hence, we apply Case 1: If f(n) = O(nlog
b
a-ϵ), then T(n) = Θ(nlog
b
a).
• f(n) = n = O(n2−ϵ) for, say, ϵ = 0.5. Thus, T(n) = Θ(nlog
b
a) = Θ(n2)
Consider T(n) = 4T(n/2) + n2
Semester-06/2020-2021 Dr.Nisha Soms/SRIT 10
•The given recurrence equation is of the form T(n) = a T(n/b) + f(n), Hence
Master theorem can be applied to perform analysis.
•Here, a = 4, b = 2, and f(n) = n2 respectively.
•Next, We calculate nlog
b
a from the given recurrence which is nlog
2
4 , that is n2
•The f(n) = n2 of the given recurrence is same compared to the calculated n2
•Hence, we apply Case 2: If f(n) = Θ(nlog
b
a), then T(n) = Θ(nlog
b
a log n).
• f(n) = n2 = Θ(n2). Thus, T(n) = Θ(nlog
b
a log n) = Θ(n2 log n)
Consider T(n) = 4T(n/2) + n3
Semester-06/2020-2021 Dr.Nisha Soms/SRIT 11
•The given recurrence equation is of the form T(n) = a T(n/b) + f(n), Hence
Master theorem can be applied to perform analysis.
•Here, a = 4, b = 2, and f(n) = n3 respectively.
•Next, We calculate nlog
b
a from the given recurrence which is nlog
2
4 , that is n2
•The f(n) = n3 of the given recurrence is larger compared to the calculated n2
•Hence, we apply Case 3: If f(n) = Ω(nlog
b
a+ϵ ), then T(n) = Θ(f(n)).
• f(n) = n3 = Ω(n2+ϵ) for, say, ϵ = 0.5. Thus, T(n) = Θ(f(n)) = Θ(n3).
 https://medium.com/codex/divide-and-conquer-
algorithm-f766640ef038
 Introduction to the Design and Analysis of Algorithms
(3rd ed.), Anany Levitin
 https://www.cse.iitd.ac.in/~mausam/courses/col106/aut
umn2017/lectures/02-asymptotic.pdf
 https://www.coursehero.com/file/51912947/L01-
Introppt/
 https://anh.cs.luc.edu › notes
 https://web.cs.ucdavis.edu/~gusfield/cs222f07/masterm
ethod.pdf
Semester-06/2020-2021 Dr.Nisha Soms/SRIT 12
Please Click Like, Share and Subscribe !
Semester-06/2020-2021 Dr.Nisha Soms/SRIT 13

More Related Content

What's hot

CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questioCS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questioKarthik Venkatachalam
 
Backtracking based integer factorisation, primality testing and square root c...
Backtracking based integer factorisation, primality testing and square root c...Backtracking based integer factorisation, primality testing and square root c...
Backtracking based integer factorisation, primality testing and square root c...csandit
 
Module 2 Design Analysis and Algorithms
Module 2 Design Analysis and AlgorithmsModule 2 Design Analysis and Algorithms
Module 2 Design Analysis and AlgorithmsCool Guy
 
Kirchoff''s matrix tree theorem
Kirchoff''s matrix tree theoremKirchoff''s matrix tree theorem
Kirchoff''s matrix tree theoremSwathiSundari
 
A NEW PARALLEL ALGORITHM FOR COMPUTING MINIMUM SPANNING TREE
A NEW PARALLEL ALGORITHM FOR COMPUTING MINIMUM SPANNING TREEA NEW PARALLEL ALGORITHM FOR COMPUTING MINIMUM SPANNING TREE
A NEW PARALLEL ALGORITHM FOR COMPUTING MINIMUM SPANNING TREEijscmc
 
Clustering techniques
Clustering techniquesClustering techniques
Clustering techniquestalktoharry
 
ICDE-2015 Shortest Path Traversal Optimization and Analysis for Large Graph C...
ICDE-2015 Shortest Path Traversal Optimization and Analysis for Large Graph C...ICDE-2015 Shortest Path Traversal Optimization and Analysis for Large Graph C...
ICDE-2015 Shortest Path Traversal Optimization and Analysis for Large Graph C...Waqas Nawaz
 
Master method
Master method Master method
Master method Rajendran
 
A Fixed Point Theorem Using Common Property (E. A.) In PM Spaces
A Fixed Point Theorem Using Common Property (E. A.) In PM SpacesA Fixed Point Theorem Using Common Property (E. A.) In PM Spaces
A Fixed Point Theorem Using Common Property (E. A.) In PM Spacesinventionjournals
 
Discrete lecture 01
Discrete lecture 01Discrete lecture 01
Discrete lecture 01Raja Hamid
 
Fundamentals of Finite Difference Methods
Fundamentals of Finite Difference MethodsFundamentals of Finite Difference Methods
Fundamentals of Finite Difference Methods1rj
 
Perform brute force
Perform brute forcePerform brute force
Perform brute forceSHC
 
Mit2 092 f09_lec10
Mit2 092 f09_lec10Mit2 092 f09_lec10
Mit2 092 f09_lec10Rahman Hakim
 

What's hot (20)

CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questioCS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
 
Backtracking based integer factorisation, primality testing and square root c...
Backtracking based integer factorisation, primality testing and square root c...Backtracking based integer factorisation, primality testing and square root c...
Backtracking based integer factorisation, primality testing and square root c...
 
Module 2 Design Analysis and Algorithms
Module 2 Design Analysis and AlgorithmsModule 2 Design Analysis and Algorithms
Module 2 Design Analysis and Algorithms
 
Lab no.07
Lab no.07Lab no.07
Lab no.07
 
Kirchoff''s matrix tree theorem
Kirchoff''s matrix tree theoremKirchoff''s matrix tree theorem
Kirchoff''s matrix tree theorem
 
L2
L2L2
L2
 
Extrapolation
ExtrapolationExtrapolation
Extrapolation
 
Chapter two
Chapter twoChapter two
Chapter two
 
A NEW PARALLEL ALGORITHM FOR COMPUTING MINIMUM SPANNING TREE
A NEW PARALLEL ALGORITHM FOR COMPUTING MINIMUM SPANNING TREEA NEW PARALLEL ALGORITHM FOR COMPUTING MINIMUM SPANNING TREE
A NEW PARALLEL ALGORITHM FOR COMPUTING MINIMUM SPANNING TREE
 
Business Logistics Assignment Help
Business Logistics Assignment HelpBusiness Logistics Assignment Help
Business Logistics Assignment Help
 
Clustering techniques
Clustering techniquesClustering techniques
Clustering techniques
 
ICDE-2015 Shortest Path Traversal Optimization and Analysis for Large Graph C...
ICDE-2015 Shortest Path Traversal Optimization and Analysis for Large Graph C...ICDE-2015 Shortest Path Traversal Optimization and Analysis for Large Graph C...
ICDE-2015 Shortest Path Traversal Optimization and Analysis for Large Graph C...
 
Master method
Master method Master method
Master method
 
Logistics Management Assignment Help
Logistics Management Assignment Help Logistics Management Assignment Help
Logistics Management Assignment Help
 
A Fixed Point Theorem Using Common Property (E. A.) In PM Spaces
A Fixed Point Theorem Using Common Property (E. A.) In PM SpacesA Fixed Point Theorem Using Common Property (E. A.) In PM Spaces
A Fixed Point Theorem Using Common Property (E. A.) In PM Spaces
 
Discrete lecture 01
Discrete lecture 01Discrete lecture 01
Discrete lecture 01
 
Fundamentals of Finite Difference Methods
Fundamentals of Finite Difference MethodsFundamentals of Finite Difference Methods
Fundamentals of Finite Difference Methods
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
 
Perform brute force
Perform brute forcePerform brute force
Perform brute force
 
Mit2 092 f09_lec10
Mit2 092 f09_lec10Mit2 092 f09_lec10
Mit2 092 f09_lec10
 

Similar to Recursive Algorithms Divide and Conquer Approach

Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Traian Rebedea
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutionssubhashchandra197
 
ATT00001ATT00002ATT00003ATT00004ATT00005CARD.docx
ATT00001ATT00002ATT00003ATT00004ATT00005CARD.docxATT00001ATT00002ATT00003ATT00004ATT00005CARD.docx
ATT00001ATT00002ATT00003ATT00004ATT00005CARD.docxikirkton
 
Improvised Master's Theorem
Improvised Master's TheoremImprovised Master's Theorem
Improvised Master's TheoremLaiba Younas
 
Sienna 4 divideandconquer
Sienna 4 divideandconquerSienna 4 divideandconquer
Sienna 4 divideandconquerchidabdu
 
SURF 2012 Final Report(1)
SURF 2012 Final Report(1)SURF 2012 Final Report(1)
SURF 2012 Final Report(1)Eric Zhang
 
RecurrenceAndMasterTheorem.ppt
RecurrenceAndMasterTheorem.pptRecurrenceAndMasterTheorem.ppt
RecurrenceAndMasterTheorem.pptISHAN194169
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxGadaFarhan
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programmingJay Nagar
 
Master’s theorem Derivative Analysis
Master’s theorem Derivative AnalysisMaster’s theorem Derivative Analysis
Master’s theorem Derivative AnalysisIRJET Journal
 
Skiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingSkiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingzukun
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 

Similar to Recursive Algorithms Divide and Conquer Approach (20)

Daa chapter 2
Daa chapter 2Daa chapter 2
Daa chapter 2
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutions
 
ATT00001ATT00002ATT00003ATT00004ATT00005CARD.docx
ATT00001ATT00002ATT00003ATT00004ATT00005CARD.docxATT00001ATT00002ATT00003ATT00004ATT00005CARD.docx
ATT00001ATT00002ATT00003ATT00004ATT00005CARD.docx
 
Improvised Master's Theorem
Improvised Master's TheoremImprovised Master's Theorem
Improvised Master's Theorem
 
Sienna 4 divideandconquer
Sienna 4 divideandconquerSienna 4 divideandconquer
Sienna 4 divideandconquer
 
SURF 2012 Final Report(1)
SURF 2012 Final Report(1)SURF 2012 Final Report(1)
SURF 2012 Final Report(1)
 
RecurrenceAndMasterTheorem.ppt
RecurrenceAndMasterTheorem.pptRecurrenceAndMasterTheorem.ppt
RecurrenceAndMasterTheorem.ppt
 
2.pptx
2.pptx2.pptx
2.pptx
 
Divide and Conquer
Divide and ConquerDivide and Conquer
Divide and Conquer
 
L2
L2L2
L2
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Master’s theorem Derivative Analysis
Master’s theorem Derivative AnalysisMaster’s theorem Derivative Analysis
Master’s theorem Derivative Analysis
 
Skiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sortingSkiena algorithm 2007 lecture09 linear sorting
Skiena algorithm 2007 lecture09 linear sorting
 
Recursive algorithms
Recursive algorithmsRecursive algorithms
Recursive algorithms
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
 
Algorithms Exam Help
Algorithms Exam HelpAlgorithms Exam Help
Algorithms Exam Help
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
numerical.ppt
numerical.pptnumerical.ppt
numerical.ppt
 

Recently uploaded

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 

Recently uploaded (20)

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

Recursive Algorithms Divide and Conquer Approach

  • 1. UCSE010 - DESIGN AND ANALYSIS OF ALGORITHMS 1 Dr.Nisha Soms/SRIT Semester-06/2020-2021
  • 2.  Many useful algorithms are recursive in nature.  To solve a given problem, they call themselves recursively one or more times.  These algorithms typically follow a divide & Conquer approach. Semester-06/2020-2021 Dr.Nisha Soms/SRIT 2
  • 3.  Step 1:  Divide the given big problem into a number of sub-problems that are similar to the original problem but smaller in size. A sub-problem may be further divided into its sub-problems. A Boundary stage reaches when either a direct solution of a sub-problem at some stage is available or it is not further sub-divided. When no further sub-division is possible, we have a direct solution for the sub-problem.  Step 2:  Conquer (Solve) each solutions of each sub-problem (independently) by recursive calls; and then  Step 3:  Combine the solutions of each sub-problems to generate the solutions of original problem. 3 Dr.Nisha Soms/SRIT
  • 5.  Any algorithms which follow the divide-and-conquer strategy have the following recurrence form: 5 Dr.Nisha Soms/SRIT
  • 6.  Where  T(n) = running time of a problem of size n  a means “In how many part the problem is divided”  aT(n/b) means “Time required to solve a sub-problem each of size (n/b)”  If the problem size is small enough (say, n ≤ c for some constant c), we have a base case. The brute-force (or direct) solution takes constant time: Θ(1)  D(n) is the cost(or time) of dividing the problem of size n.  C(n) is the cost (or time) to combine the sub-solutions. 6 Dr.Nisha Soms/SRIT
  • 7.  Merge sort  Quick sort  Binary search  Multiplication of Large Integers  Strassen’s Matrix Multiplication  Closest-Pair  Convex-Hull Problems. Semester-06/2020-2021 Dr.Nisha Soms/SRIT 7
  • 8.  An analysis theorem that can be used to solve the time complexity of recurrence relations of the form: T(n) = aT(n/b) + f(n)  If a ≥ 1 and b > 1 are constants and f(n) is an asymptotically positive function, then the Time complexity of a recursive relation T(n) has the following asymptotic bounds:  Case 1: If f(n) = O(nlog b a-ϵ), then T(n) = Θ(nlog b a).  Case 2: If f(n) = Θ(nlog b a), then T(n) = Θ(nlog b a * log n).  Case 3: If f(n) = Ω(nlog b a+ϵ), then T(n) = Θ(f(n)). Where ϵ > 0 is a constant. Semester-06/2020-2021 Dr.Nisha Soms/SRIT 8
  • 9. Consider T(n) = 4T(n/2) + n Semester-06/2020-2021 Dr.Nisha Soms/SRIT 9 •The given recurrence equation is of the form T(n) = a T(n/b) + f(n), Hence Master theorem can be applied to perform analysis. •Here, a = 4, b = 2, and f(n) = n respectively. •Next, We calculate nlog b a from the given recurrence which is nlog 2 4 , that is n2 •The f(n) = n of the given recurrence is less when compared with the calculated n2 •Hence, we apply Case 1: If f(n) = O(nlog b a-ϵ), then T(n) = Θ(nlog b a). • f(n) = n = O(n2−ϵ) for, say, ϵ = 0.5. Thus, T(n) = Θ(nlog b a) = Θ(n2)
  • 10. Consider T(n) = 4T(n/2) + n2 Semester-06/2020-2021 Dr.Nisha Soms/SRIT 10 •The given recurrence equation is of the form T(n) = a T(n/b) + f(n), Hence Master theorem can be applied to perform analysis. •Here, a = 4, b = 2, and f(n) = n2 respectively. •Next, We calculate nlog b a from the given recurrence which is nlog 2 4 , that is n2 •The f(n) = n2 of the given recurrence is same compared to the calculated n2 •Hence, we apply Case 2: If f(n) = Θ(nlog b a), then T(n) = Θ(nlog b a log n). • f(n) = n2 = Θ(n2). Thus, T(n) = Θ(nlog b a log n) = Θ(n2 log n)
  • 11. Consider T(n) = 4T(n/2) + n3 Semester-06/2020-2021 Dr.Nisha Soms/SRIT 11 •The given recurrence equation is of the form T(n) = a T(n/b) + f(n), Hence Master theorem can be applied to perform analysis. •Here, a = 4, b = 2, and f(n) = n3 respectively. •Next, We calculate nlog b a from the given recurrence which is nlog 2 4 , that is n2 •The f(n) = n3 of the given recurrence is larger compared to the calculated n2 •Hence, we apply Case 3: If f(n) = Ω(nlog b a+ϵ ), then T(n) = Θ(f(n)). • f(n) = n3 = Ω(n2+ϵ) for, say, ϵ = 0.5. Thus, T(n) = Θ(f(n)) = Θ(n3).
  • 12.  https://medium.com/codex/divide-and-conquer- algorithm-f766640ef038  Introduction to the Design and Analysis of Algorithms (3rd ed.), Anany Levitin  https://www.cse.iitd.ac.in/~mausam/courses/col106/aut umn2017/lectures/02-asymptotic.pdf  https://www.coursehero.com/file/51912947/L01- Introppt/  https://anh.cs.luc.edu › notes  https://web.cs.ucdavis.edu/~gusfield/cs222f07/masterm ethod.pdf Semester-06/2020-2021 Dr.Nisha Soms/SRIT 12
  • 13. Please Click Like, Share and Subscribe ! Semester-06/2020-2021 Dr.Nisha Soms/SRIT 13