Lecture 11 Summary

This lecture introduces the most basic divide and conquer recurrences. The pace of the lecture is fairly slow.

The student audio is very difficult to hear - you will have to rely on the instructor repeating student comments.


The point that is being made in the introduction to the lecture is that this material is important because:


Instructor gives a summary of merge sort.


Instructor analyzes the performance with the help of students. At 5:10 the instructor asks how much work the merge step is - stop for an answer. Students seem to answer quietly.

At 9:00 there is a technical question that is not audible. Not important.


At 11:00 the instructor asks how to solve this type of recurrence. A student gives the answer "look for a pattern", and then later says something about unrolling the recurrence. A second answer - guess and check is given.



Quite a bit of time is spent on this - as it shows how the recurrence is solved. At 17:00 the intructor asks "How much work is done on the second level", and at 17:15 the instructor asks "How much work is done on the third level". These are answered quietly by students.

At 18:00 he asks how many levels. A student answers at some point, but the instructor doesn't write down the answer until 18:30.

At about 19:10 there is a student question about adding one to the height. It is hard to hear. The instructor hasn't been that careful about whether it is log n, or log n + 1. This depends on the base case. Since we are doing a big-Oh analysis, it is not very important.


The other approach for recurrences is to guess and verify. This is done with an induction proof. The question asked at 22:55 is "What is the induction hypothesis" It took a while to get the desired answer of T(n/2) << c(n/2)log (n/2)


The next example is a 3-way merge sort, which is presented since it gives a different recurrence.

There is an interchange early on the slide, where the instructor askes if 3-way merge is better. After some time there is a student response to the effect: "If it were better, we would already have heard about it".

There is a student discussion now about whether 3-way is better than 2-way or not. You could stop the video to discuss this point.

Students make the two arguements - that it is more work on the merge (so it would be slower), or that it's height is less (so it would be faster). The instructor then makes a joke "Taste's great - less filling" - this probably doesn't make sense (it is a line from a famous American beer commercial).

A student makes a comment that if it's an improvement with a 3-way merge, then it would be an improvement with an n-way merge.

At 30:00 the instructor finally asks for the recurrence. You should do this as a student submission.


The next slide begins with an unrolling of the recurrence. The question how many levels is asked at about 33:00, and the result is given.

At about 34:30, the problem is generalized to a K-wise merge.

At about 36:00 there is a very good student comment (which you may be able to hear). The student thinks that the constant for the merge (ck) should be order k, but the savings from the logkn is only logarithmic.

The discussion at 37:00 is describing two different ways of doing a k-way merge.

At 38:00 a student makes a great observation that in k = n, then merge sort becomes heap sort.



The next example is the recurrence T(n) = T(n/2) + cn. The question that is asked is where this recurrence comes from. Stop the video and try to get some answers (either verbally or with students submissions). Stop at about 41:00.

You are likely to get the answer binary search. This is not a correct answer (since binary search should satisfy the recurrence T(n) = T(n/2) + 1).

The instructor describes an answer to this.


The final topic is solving the recurrence exactly. This is done by unrolling to get a summation.

At 49:00 the instructor asks the value of the geometric series. (This is the one series that students should know in an algorithms class)