quiz1_sol

quiz1_sol - Introduction to Algorithms Massachusetts...

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

View Full Document Right Arrow Icon
Introduction to Algorithms October 14, 2005 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik D. Demaine and Charles E. Leiserson Handout 14 Quiz 1 Solutions Do not open this quiz booklet until you are 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. This quiz contains 4 problems, some with multiple parts. You have 80 minutes to earn 80 points. This quiz booklet contains 13 pages, including this one. Two extra sheets of scratch paper are attached. Please detach them before turning in your quiz at the end of the examination period. This quiz is closed book. You may use one handwritten A4 or 8 1 × 11 crib sheet. No 2 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 Parts Points Grade Grader 1 4 12 2 1 7 3 11 44 4 3 17 Total 80 Name:
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Handout 14: Quiz 1 Solutions Problem 1. Asymptotic Running Times [12 points] (4 parts) For each algorithm listed below, give a recurrence that describes its worst-case running time, and give its worst-case running time using -notation. You need not justify your answers. (a) Binary search Solution: T ( n ) = T ( n/ 2) + (1) = (lg n ) (b) Insertion sort Solution: T ( n ) = T ( n 1) + ( n ) = ( n 2 )
Background image of page 2
3 Handout 14: Quiz 1 Solutions (c) Strassen’s algorithm n lg 7 ) Solution: T ( n ) = 7 T ( n/ 2) + ( n 2 ) = ( (d) Merge sort Solution: T ( n ) = 2 T ( n/ 2) + ( n ) = ( n lg n )
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Handout 14: Quiz 1 Solutions Problem 2. Substitution Method [7 points] Consider the recurrence T ( n ) = T ( n/ 2) + T ( n/ 4) + n , T ( m ) = 1 for m 5 . Use the substitution method to give a tight upper bound on the solution to the recurrence using O -notation. Solution:
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2009 for the course CS 6.033 taught by Professor S during the Fall '09 term at MIT.

Page1 / 15

quiz1_sol - Introduction to Algorithms Massachusetts...

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

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