This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Introduction to Algorithms November 18, 2002 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Quiz 2 Quiz 2 Do not open this quiz booklet until you are directed to do so. Read all the instructions first. For this quiz, you need not provide rigorous proofs of correctness. Instead, give infor mal arguments for why you believe your algorithms are correct. Pseudocode is only required when explicitly indicated, but you may include it if it clarifies your answers. When the quiz begins, write your name on every page of this quiz booklet. The quiz contains 4 multipart problems. You have 80 minutes to earn 80 points. This quiz booklet contains 11 pages, including this one. Two extra sheets of scratch paper are attached. Please detach them before turning in your quiz. This quiz is closed book. You may use one handwritten A4 or crib sheet. No calculators or programmable devices are permitted. Write your solutions in the space provided. If you need more space, write on the back of the sheet containing the problem. Do not put part of the answer to one problem on the back of the sheet for another problem, since the pages may be separated for grading. Do not waste time and paper rederiving facts that we have studied. It is sufficient to cite known results. Do not spend too much time on any one problem. Read them all through first, and attack them in the order that allows you to make the most progress. Show your work, as partial credit will be given. You will be graded not only on the correct ness of your answer, but also on the clarity with which you express it. Be neat. Good luck! Problem Points Grade Initials Name (all pages) 1 1 20 2 18 3 17 4 24 Total 80 Name: Solutions Circle the name of your recitation instructor: Moses Jen Steve 6.046J/18.410J Quiz 2 Name 2 Problem 1. Short Answer [20 points] Give brief , but complete, answers to the following questions. (a) In each of the trees below, label the nodes of the tree to make it a redblack tree, or prove that no such labelling exists. Use the following convention: label the black nodes with a ‘B,’ and the red nodes with an ‘R’. B B R B B R R Solution: The second tree cannot be colored, because it has a roottoleaf path of 5 nodes, and one of 2 nodes. The latter path can have at most 2 black nodes. On the other hand, since the root node must be colored black, and there cannot be two red nodes in a row, the path with 5 nodes must have at least 3 black nodes. This would be a violation of the blackheight property. 6.046J/18.410J Quiz 2 Name 3 (b) Name some similarities and differences between the Divide and Conquer and Dy namic Programming paradigms. For each paradigm, name a problem to which the paradigm is applied....
View
Full
Document
This note was uploaded on 11/26/2009 for the course CIS 502 taught by Professor Naver during the Spring '09 term at National Tsing Hua University, China.
 Spring '09
 Naver
 Algorithms

Click to edit the document details