Divide and Conquer Paradigm
By: Melissa Manley
Divide and Conquer Paradigm By: Melissa Manley How does it work? - - PowerPoint PPT Presentation
Divide and Conquer Paradigm By: Melissa Manley How does it work? Divide : the original problem into two or more sub-problems Recursively solves the sub-problems Conquer : by then combining the solutions to these sub-problems
By: Melissa Manley
Divide: the original problem into two or more sub-problems
Recursively solves the sub-problems
Conquer: by then combining the solutions to these sub-problems
Allows us to solve difficult problems Helps find other efficient algorithms Effectively uses Memory Caches Sometimes will produce more precise
Recursion is slow
Occasionally more complicated than an iterative
approach
Sub-problems can occur more than once
Referred to as the “ultimate divide and conquer algorithm”
The main concept: decides to use one half
For example, if trying to find a key k in a set
Compare k to n/2 Based on this result, use either the 1st or 2nd half of the data
The merge sort divides the data into two halves
It then recursively solves each half of the data
Then merges the data sets back together after they have been sorted
A Random sorting algorithm
Sorts by applying the divide and conquer strategy.
How it works:
Pick a random element from the set Divide the data into 3 groups Recursively sort the sub-list of lesser elements
and the sub-list of greater elements.
most common Fast
Fourier Transform
Originally used by
Carl Friedrich Gauss
Been rediscovered
many times and popularized by J. W. Cooley and J. W. Tukey in 1965
It is a D & C algorithm Recursively breaks down a Discrete Fourier
Transform of size N = N1N2 into smaller DFT’s of size N1 and N2.
Based on three criteria:
The # of sub instances the problem is split into
The ratio of the original problem size to the sub problem size
The number of steps required to divide and conquer
O(nlog(n)) (Fastest) Quicksort O(nlog(n)) (Fast) Mergesort O(n^2) (Slow) Insertion Sort O(n^2) (Slow) Selection Sort Running Times Algorithm