6 - (is of the same size). You can try tting a nut with a...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS180 Winter 2011 Homework 6 The following homework was due Wednesday, February 23. 1. Consider two number a and b of length n , i.e. each of them is n bits long. A very simple solution for multiplying the two numbers takes O ( n 2 ) time. We want to improve the time taken. Give a better algorithm, and the time complexity. Hint: Lets say a = a 1 2 n 2 + a 2 and b = b 1 2 n 2 + b 2 . Now a · b = ( a 1 · b 1 )2 n +( a 1 · b 2 + b 1 · a 2 )2 n 2 + a 2 · b 2 . Now to evaluate a · b we need to solve four problems of smaller size. Can we evaluate a · b by solving fewer sub-problems? 2. Consider n nuts and n screws. Assume that for each screw there exists only one nut that fits
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (is of the same size). You can try tting a nut with a screw. After one such trial either the nut turns out to be bigger than the screw, or they t nicely or the nut turns out to be smaller than the screw. Give an algorithm to pair the nuts with the corresponding matching (of the same size) screws making as few tting trials (asymptotically) as possible. 3. Problem 5 Pg 248 from book. 1...
View Full Document

Ask a homework question - tutors are online