Unit 3 - Divide and Conquer Algorithm
Unit 3 - Divide and Conquer Algorithm
Introduction
Recurrence relations
Multiplying large Integers Problem
Binary Search
Merge Sort
Quick Sort
Matrix Multiplication
Exponentiation
1
Introduction
Divide & conquer is a general algorithm design strategy
with a general plan as follows:
• 1. DIVIDE: A problem’s instance is divided into several
smaller instances of the same problem, ideally of about the
same size.
Problem Problem
of Size of Size
n/2 n/2
Solution to
original problem 3
• We need to divide the integer in two portion left and right. (12 and 34)
• p = wy = 09 * 12 = 108
• q = xz = 81 * 34 = 2754
• r = (w + x) * (y + z) = 90 * 46 = 4140
• 1234*4321 = ?
• At the (log 2 n)th level, the sub problems get down to size 1,
and so the recursion ends.
40 20 10 80 60 50 7 30 100