This preview shows page 1. Sign up to view the full content.
Unformatted text preview: A. (d) [5 points] Explain how to check whether C = A3/4 , again using only O(1) additions, subtractions, multiplications, and comparisons.
Hint: Recall how the ﬂoor function is deﬁned.
Solution: If C = A3/4 , then by the deﬁnition of the ﬂoor function, we have C ≤
A3/4 and C + 1 > A3/4 . We can check both of these using the technique from part
(c). 9 6.006 Quiz 2 Solutions Name (e) [5 points] Give a brief description of an algorithm that takes as input a ddigit positive
integer A and computes A3/4 . The only arithmetic operations you can use are integer addition, integer subtraction, integer multiplication, integer division, and integer
comparison. Your algorithm should use Θ(lg d) arithmetic operations in total, but partial credit will be awarded for using Θ(d) arithmetic operations. For this question, you
may assume that Newton’s Method has a quadratic rate of convergence for whatever
function you devise.
Solution:
Θ(lg d) Solution: The technique from part (b) didn’t work beca...
View
Full
Document
This document was uploaded on 03/17/2014 for the course ELECTRICAL 6.006 at MIT.
 Fall '11
 ErikDemaine

Click to edit the document details