This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 473: Fundamental Algorithms, Spring 2011 HW 7 Question 1 is due by Sunday, 23:59:59, March 27 Questions 24 are due by Monday, 23:59:59, March 28 This homework contains four problems. Read the instructions for submitting homework on the course webpage . Collaboration Policy: For this homework, Problems 2–4 can be worked in groups of up to three students. Problem 1 should be answered in Compass as part of the assessment HW7Online and should be done individually. 1. HW7Online. (20 pts.) 2. Voting tree (30 pts.) Consider a uniform rooted tree of height h (every leaf is at distance h from the root). The root, as well as any internal node, has 3 children. Each leaf has a boolean value associated with it. Each internal node returns the value returned by two or three of its children. The evaluation problem consists of determining the value of the root; at each step, an algorithm can choose one leaf whose value it wishes to read. (A) (30 pts.) Consider the recursive randomized algorithm that evaluates two subtrees of the root chosen at random. If the values returned disagree, it proceeds to evaluate the third subtree. If they agree, it returns the value they agree on. Show the expected number of leaves read by the algorithm on any instance is at most n . 9 . Solution : Let L ( h ) be the worstcase expected number of leaves read when the input tree has height h . Consider the moment when our randomized algorithm computes the value of the root. If the algorithm is “lucky” it just evaluates two of children’s subtrees, otherwise it has to evaluate all three of them. Note that the expected number of leaves read during evaluating each of those subtrees is no greater than L ( h 1). Also note that with probability at least 1 3 the algorithm is “lucky” (to be lucky it is enough to exclude the child with the minority value among the three childs first). Therefore we have ( n = 3 h ): L ( h ) ≤ 1 3 2 L ( h 1) + 2 3 3 L ( h 1) = 8 3 L ( h 1) = ⇒ L ( h ) = ( 8 3 ) h = n log 3 8 1 < n . 9 1 Rubrik : • 5pts: Basic understanding, for example the solution shows that the student is aware that the expectation is over random bits not the input distribution. • 5pts: Correct probability analysis per node. • 10pts: Correct recurrence. • 10pts: Correct solution. (B) (Extra credit.) (10 pts.) Show that for any deterministic algorithm, there is an instance (a set of boolean values for the leaves) that forces it to read all n = 3 h leaves. (hint: Consider an adversary argument, where you provide the algorithm with the minimal amount of information as it request bits from you. In particular, one can devise such an adversary algorithm.). Solution : Consider a deterministic algorithm A that solves this problem. We will show that there is a bad input of every height h for this algorithm A . We produce this bad input somehow on the fly: assume that some person called “adversary” actually marks the leaves of the tree with values 0 or 1. Adversary actually doesn’t mark the leaves before the algorithmtree with values 0 or 1....
View
Full
Document
This note was uploaded on 04/18/2011 for the course CS 473 taught by Professor Chekuri,c during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Chekuri,C
 Algorithms

Click to edit the document details