Table of Contents

Chapter 5

5.1 A First Recurrence: The Mergesort Algorithm

Approaches to Solving Recurrences

  1. “unroll” the recursion, accounting for the running time across the first few levels, identifying a pattern that can be continues as the recursion expands. Sum up the running times over all levels → total running time
  2. Start with a guess, substitute in the recurrence relation, check if it works; Use an argument by induction on n to formally justify this approach

Unrolling the MergeSort Recurrence

Substituting a Solution into the Mergesort Recurrence

An Approach Using Partial Substitution

Personal Thoughts

Using mergesort as the example was helpful, as I am pretty familiar with that algorithm at this point. We went over it in class which helped me follow along with the step-by-step process of coming up with an appropriate recurrence relation. Still though, this material is a little difficult for me and I know I'll need more practice with its application before I really understand it.

Readability: 6.0 Interesting: 6.0

5.2 Further Recurrence Relations

The Case of q>2 Subproblems

The Case of One Subproblem

A Related Recurrence: T(n) ⇐2T(n/2)+O(n^2)

Personal Thoughts

This section took a while to digest as there are mathematical equations at each step. I think I will have to refer back to this section and the examples until I get the hang of it, but for the most part the section laid out the recurrence relations in a very step-by-step manner that made it easier to follow.

Readability: 6.0 Interesting: 6.0

5.3 Counting Inversions

The Problem

Designing and Analyzing the Algorithm

Personal Thoughts

I thought this section provided a very interesting algorithm to count the number of inversions in O(nlogn) time. The combination of this section and the classroom discussion did a pretty good job of helping me understand this material. It also helped that we were introduced to inversions in another chapter/section. This made it so that the concept as a whole wasn't as difficult to understand. The algorithm and runtime both make sense to me.

Readability: 7.0 Interesting: 7.0