q1-s2010-sol

q1-s2010-sol - Introduction to Algorithms March 10, 2010...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Introduction to Algorithms March 10, 2010 Massachusetts Institute of Technology 6.006 Spring 2010 Professors Piotr Indyk and David Karger Quiz 1 Quiz 1 Do not open this quiz booklet until directed to do so. Read all the instructions on this page. When the quiz begins, write your name on every page of this quiz booklet. You have 120 minutes to earn 120 points. 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. This quiz is closed book. You may use one 8 1 2 00 11 00 or A4 crib sheet (both sides). No calculators or programmable devices are permitted. No cell phones or other communications 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. 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. When asked for an algorithm, your algorithm should have the time complexity specified in the problem. If you cannot find such an algorithm, you will generally receive partial credit for a slower algorithm if you analyze your algorithm correctly . 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 Parts Points Grade Grader 1 2 2 2 9 18 3 3 20 4 1 20 5 2 25 6 3 20 7 2 15 Total 120 Name: Friday Recitation: Zuzana 10 AM Debmalya 11 AM Ning 12 PM Matthew 1 PM Alina 2 PM Alex 3 PM 6.006 Quiz 1 Name 2 Problem 1. What is Your Name? [2 points] (2 parts) (a) [1 point] Flip back to the cover page. Write your name there. (b) [1 point] Flip back to the cover page. Circle your recitation section. 6.006 Quiz 1 Name 3 Problem 2. True or False [18 points] (9 parts) For each of the following questions, circle either T (True) or F (False). There is no penalty for incorrect answers. (a) T F [2 points] Given two heaps with n elements each, it is possible to construct a single heap comprising all 2 n elements in O ( n ) time. Solution: TRUE. Simply traverse each heap and read off all 2 n elements into a new array. Then, make the array into a heap in O ( n ) time by calling MAX- HEAPIFY for i = 2 n down to 1 . (b) T F [2 points] Building a heap with n elements can always be done in O ( n log n ) time. Solution: TRUE. In fact, we can build a heap in O ( n ) time by putting the elements in an array and then calling MAX-HEAPIFY for i = n down to 1 . (c) T F [2 points] Given a hash table of size n with n elements, using chaining, the minimum element can always be found in O (1) time....
View Full Document

Page1 / 14

q1-s2010-sol - Introduction to Algorithms March 10, 2010...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online