divide and conquer paradigm
play

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


  1. Divide and Conquer Paradigm By: Melissa Manley

  2. 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

  3. & Gauss Karatsuba & Gauss Karatsuba

  4. Advantages  Allows us to solve difficult problems  Helps find other efficient algorithms  Effectively uses Memory Caches  Sometimes will produce more precise outcomes.

  5. Disadvantages  Recursion is slow  Occasionally more complicated than an iterative approach  Sub-problems can occur more than once

  6. Binary Search Referred to as the “ultimate divide and  conquer algorithm” The main concept: decides to use one half  of the data set, or the other For example, if trying to find a key k in a set  of keys containing data z[0,1,…,n-1] :   Compare k to n/2  Based on this result, use either the 1 st or 2 nd half of the data

  7. Binary Search Tree

  8. Mergesort Algorithm 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

  9. Quicksort Algorithm 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.

  10. Cooley Tukey FFT Algorithm  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

  11. Cooley-Tukey  It is a D & C algorithm  Recursively breaks down a Discrete Fourier Transform of size N = N 1 N 2 into smaller DFT’s of size N 1 and N 2.

  12. Running Time 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

  13. Comparing different sorting algorithm Running Times Algorithm Running Times Selection Sort O(n^2) (Slow) Insertion Sort O(n^2) (Slow) Mergesort O(nlog(n)) (Fast) Quicksort O(nlog(n)) (Fastest)

Recommend


More recommend