Provide a recurrence relation for the quantity described in each of the following problems (these can be the basis for a dynamic programming algorithm to solve these problems; we will discuss this technique in class this week).
Let us call the graph G a path if its nodes can be written as v0, v1, ..., vn-1 with an edge between vi and vj if and only if the numbers i and j are consecutive. With each node vi we associate a positive integer weight wi. For example, in the following path, the weights are the numbers drawn inside the nodes.
Define recurrence relations for
To notify everyone of the postponement, the CSSS president first calls each of the students who bought their tickets directly from him/her, one at a time (his/her "children"). As soon as one of these students has been notified, he/she can then notify all of his/her "children".
We can picture this process as being divided into rounds. In one round, each person who has already learned of the postponement can call one of his/her children. The number of rounds it takes for everyone to be notified depends on the sequence in which each person makes their phone calls. For instance, in the following figure, it will take only two rounds if A calls B first, but three rounds if A starts by calling D (note that A can not call C directly).
Write a recurrence relation for R(N), the minimum number of rounds needed to inform all descendants of a node N.
A simple approach that is at least reasonably effective is to find a segmentation that simply maximizes the cumulative "quality" of its individual constituent words. Thus, suppose you are given a black box that for any string of letters x = x0, x1, ..., xk will return a number Q(x). This number can be either positive or negative; larger numbers correspond to more plausible English words. So Q(me) would be positive, while Q(ght) would be negative.
Given a long string of letters y = y0, y1, ..., yn-1, a segmentation of y is a partition of its letters into contiguous blocks of letters; each block corresponds to a word in the segmentation. The total quality of a segmentation is determined by adding up the qualities of each of its blocks. So we would get the right answer for the problem above provided that Q(meet) + Q(at) + Q(eight) was greater than the total quality of any other segmentation of the string.
Give a recurrence relation for TQ(i): the maximum total quality of any segmentation of the letters y0, y1, ..., yi. Hint: look for the position of the first letter of the current "word".