Design divide-and-conquer algorithms and bound them with the master theorem

8 steps · about 3 h 20 min · Intermediate

  1. Learn the divide, conquer, combine pattern (article, Khan Academy, 10 min)

    A gentle introduction to the three steps with merge sort.

  2. Survey where divide and conquer applies (article, Wikipedia, 15 min)

    Lists classic uses and implementation issues such as recursion depth.

  3. Bound recurrences with the master theorem (article, Wikipedia, 20 min)

    Gives the three cases for T(n) = aT(n/b) + f(n) with examples.

  4. Watch divide and conquer on convex hull and medians (video, MIT OpenCourseWare, 1 h 20 min)

    MIT lecture applying the method to two non-trivial problems.

  5. Multiply large numbers faster with Karatsuba (article, Wikipedia, 15 min)

    Shows how saving one recursive call changes the exponent.

  6. Apply the same trick to matrix multiplication (article, Wikipedia, 15 min)

    Seven products instead of eight gives a sub-cubic algorithm.

  7. Find the closest pair of points in n log n (article, Wikipedia, 15 min)

    A geometric problem where the combine step is the clever part.

  8. Implement closest pair of points (tutorial, cp-algorithms, 30 min)

    Full implementation with the strip argument explained.