Download presentation
Presentation is loading. Please wait.
1
Lecture 4 Divide-and-Conquer
2
What’s Self-Reducibility?
A problem can be reduced to several “same” problems with smaller inputs.
3
Divide and Conquer Divide the problem into subproblems.
Conquer the subproblems by solving them recursively. Combine the solutions to subproblems into the solution for original problem.
4
Tree Structure problem subproblem subproblem subsubproblem
5
Insertion Sort
6
key
7
Merge Sort
8
Procedure divide conquer combine
9
Heapsort 16 14 10 3 8 7 9 2 4 1
10
Heapsort
11
Heapsort
12
Quicksort divide conquer combine is simplified
13
Selection with O(n) Comparisons
divide conquer divide conquer
14
Remark on Divide and Conquer
Key Point:
15
Merge Sort Quick Sort Selection Analysis requires to solve a recurrence!
16
Maximum Subarray
17
Problem
20
Closest pair of points
24
Matrix Multiplication
25
n/2 Step 1 n/2
26
Step 2 Step 3
27
Step 4
28
Master Theorem
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.