Notes for Chapter 2 - Divide and Conquer
Notes for Chapter 2 - Divide and Conquer
Introduction
•The most-well known algorithm design strategy:
•Combining all the solutions of sub problems into a solution of the whole.
•If the sub problems are large enough then divide and conquer is
reapplied
•The generated sub problems are usually of the same nature as the
original problem - hence recursive algorithms are used in Divide and
Conquer
Divide and Conquer
a problem of size n
(instance)
subproblem 1 subproblem 2
of size n/2 of size n/2
a solution to a solution to
subproblem 1 subproblem 2
• Tn = g(n) if n is small
• T(n1) + T(n2) +…….T(nn) + F(n)
• Where T(n) is the time for Divide and Conquer of size n. g(n) is the
computing time reqd. to solve small inputs. F(n) is the time reqd. for
dividing the problem P and combining the solutions to sub problems.
10 20 30 40 50 60 70
m1 + m4 - m5 + m7 m3 + m5
=
m2 + m4 m1 + m3 - m2 + m6
M1 + M4 - M5 + M7 M3 + M5
=
M2 + M4 M1 + M3 - M2 + M6
Formulae for Strassen’s Algorithm
=(n-1)-0+1=n
N-1
M(n)= Σ n^2 = n^3 M(n) = θ (n3)
i=0