Lecture 8

In this second lecture on dynamic programming we looked at two more examples: 2-PERSON JOB SCHEDULING, and OPTIMAL BINARY SEARCH TREES.

In the 2-PERSON JOB SCHEDULING problem you are trying to cheat on your 122A homework, trying to split up the problems between you and your friend so that last of you finishes as soon as possible. Thus the INSTANCE looks like a sequence of numbers (t_1, ..., t_n) ("the time to complete each problem"), and the question is to partition the numbers into two subsets such that the sum of the numbers in the larger of these two subsets is as small as possible. We did this with dynamic programming, using a Boolean table.

In the OPTIMAL BINARY SEARCH TREE problem we are given a bunch of word frequencies, p_1, ..., p_n. John used the word frequencies of the nine most frequent words in the play "Hamlet". We want to arrange these into a binary search tree (BST) such that the expected time to look up a word (according to the given frequencies) will be minimized. We described a dynamic programming solution to this problem. The solution is also specified on Handout C.