Module 2A Divide and Conquer Introduction
Module 2A Divide and Conquer Introduction
2
Learning Outcomes
Students will be able to
3
Contents
4
Divide-and-Conquer
5
Strategy
sol =
if ( prob is very small )
soln = prob.solve() Divide
else
sub_prob = prob.divide()
Conquer
for each child in sub_prob
soln = soln + child.solve()
return soln
Combine
Multiple Recursive call in
D&C
9
Well-Known Applications
– Searching
• Binary search
– Sorting
• Merge Sort
• Quick Sort
– Mathematics
• Polynomial and Matrix Multiplication
• Strassen’s Algorithm
Comparison Between Sorting Methods
Reference https://www.geeksforgeeks.org/analysis-of-different-sorting-techniques/
Links https://www.srcmake.com/home/sorting
https://latesthackingnews.com/2016/12/10/comparison-various-sorting-
algorithms/
Summary
• In divide and conquer approach, the problem in hand, is divided into
smaller sub-problems and then each problem is solved
independently.
• When we keep on dividing the subproblems into even smaller sub-
problems, we may eventually reach a stage where no more division
is possible.
• Those "atomic" smallest possible sub-problem (fractions) are
solved. The solution of all sub-problems is finally merged in order to
obtain the solution of an original problem.
12