Note: This tutorial will last for two weeks (2 Feb through 13 Feb). Your tutorial section may end up working on the midterm practice problems one week and the tutorial the other (or even reviewing especially challenging exam problems). Enjoy!
- Alice wants to throw a party and is deciding whom to call. She has n people to choose from, and she has made up a list of which pairs of these people know each other. She wants to pick as many people as possible, subject to two constraints: at the party, each person should have at least five other people whom they know and five other people whom they don’t know. Give a greedy algorithm that takes as input the list of n people and the list of pairs who know each other and outputs the best choice of party invitees. If there is no subset that satisfies the conditions, then your algorithm should return the empty set. Hint: Try to identify people who should not be invited.
- Timing circuits are a crucial component of VLSI chips. Here is a simple model of such a timing circuit. Consider a complete balanced binary tree with n leaves, where n is a power of 2. Each edge e of the tree has an associated length l(e) which is a positive integer. The distance from the root to the given leaf is the sum of the lengths of all the edges on the path from the root to the leaf. The root generates a clock signal that is propagated along the edges to the leaves. We will assume that the time it takes for the signal to reach a given leaf is proportional to the distance from the root to the leaf. For instance, in the following tree, the clock signal will take 4 units of time to reach node b, but only 2 units of time to reach f.If all leaves do not have the same distance from the root, as was the case in the example, then the signal will not reach the leaves at the same time, and this is a big problem. We want the leaves to be completely synchronized, and all to receive the signal at the same time. To make this happen, we will have to increase the lengths of certain edges, so that all root-to-leaf paths have the same length (we are not able to shrink edges lengths). If we achieve this, then the tree (with its new edge lengths) will be said to have zero skew. Our goal is to achieve zero skew in a way that keeps the sum of all the edge lengths as small as possible.Give an algorithm that increases the lengths of certain edges so that the resulting tree has zero skew, and the total edge length is as small as possible. For instance, the unique solution for the tree in the figure would be to take the three length 1 edges and increase each of their lengths to 2. The resulting tree has zero skew, and the total edge length is 12, the smallest possible.