Divide And Conquer

Posted by VitoDH Blog on December 24, 2019

Chapter 4 - Sorting and Searching - 5 - Divide And Conquer

1.Design Paradigms

1. Dynamic Programming

Remove one element from the problem, solve the smaller problem, and then uses the solution to this smaller problem to add back the element in the proper way

2. Divide and Conquer

Split the problem in halves, solve each half, then stiches the pieces back together to form a full solution

2. Recurrence Relations

E.g.

  • Fibonacci numbers
  • Polynomial
  • Exponential
  • Factorial

3. Divide-and-Conquer Recurrences

  • Break a given problem into some number of smaller pieces a, each of which is of size n/b. Further, they spend f(n) time to combine these subproblem solutions into a complete result

  • T(n): The worst-case time the algorithm takes to solve a problem of size n

E.g.

  • Sorting
  • Binary Search
  • Fast Heap Construction
  • Matrix Multiplication