Chapter 0: Prologue
12 E
The SPANNING TREE problem is the following.Input: An undirected graph Output: A spanning tree of in which each node has degree , if such a tree exists.Show that for any :
- SPANNING TREE is a search problem.
- SPANNING TREE is NP-complete. (Hint: Start with and consider the relation between this problem and RUDRATA PATH.)
13E
Consider the following game. A 鈥渄ealer鈥 produces a sequence of 鈥渃ards,鈥 face up, where each card has a value . Then two players take turns picking a card from the sequence, but can only pick the first or the last card of the (remaining) sequence. The goal is to collect cards of largest total value. (For example, you can think of the cards as bills of different denominations.) Assume is even. (a) Show a sequence of cards such that it is not optimal for the first player to start by picking up the available card of larger value. That is, the natural greedy strategy is suboptimal. (b) Give an algorithm to compute an optimal strategy for the first player. Given the initial sequence, your algorithm should precompute in time some information, and then the first player should be able to make each move optimally in time by looking up the precomputed information.
21E
A vertex cover of a graph is a subset of vertices that includes at least one endpoint of every edge in E. Give a linear-time algorithm for the following task.
Input: An undirected tree .
Output: The size of the smallest vertex cover of T. For instance, in the following tree, possible vertex covers includeandbut notThe smallest vertex cover has size 3:

Q1E
Question: 0.1. In each of the following situations, indicate whether or both (in which case

Q20E
Show that any array of integers can be sorted in O (n + M) time, where
role="math" localid="1659938331794"
For small M, this is linear time: why doesn鈥檛 the lower bound apply in this case?
Q27E
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鈥檛 know. Give an efficient 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. Give the running time in terms of n
Q2E
Show that, if c is a positive real number, then g(n) = 1 + c + c2 + 路 路 路 + cn is:
(a) 螛(1) if c < 1.
(b) 螛(n) if c = 1.
(c) 螛(cn) if c > 1.
The moral: in big-螛 terms, the sum of a geometric series is simply the first term if the series is strictly decreasing, the last term if the series is strictly increasing, or the number of terms if the series is unchanging.
Q3E
The Fibonacci numbers are defined by the rule
.
In this problem we will confirm that this sequence grows exponentially fast and obtain some bounds on its growth.
(a) Use induction to prove that for .
(b) Find a constant such that for all . Show that your answer is correct.
(c) What is the largest you can find for which ?