hw_0_soln - CS 473: Algorithms, Fall 2010 HW 0 (due...

Info iconThis preview shows pages 1–2. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 473: Algorithms, Fall 2010 HW 0 (due Tuesday, August 31st in class) This homework contains four problems. Read the instructions for submitting homework on the course webpage . In particular, make sure that you write the solutions for the problems on separate sheets of paper. Write your name and netid on each sheet. Collaboration Policy: For this home work, each student should work independently and write up their own solutions and submit them. Read the course policies before starting the homework. Problems 1-3 should be answered in Compass as part of the assessment HW0-Online. Note: Before starting to answer the questions on compass, read the following recaps: lg n = log 2 n and ln n = log e n . lg 2 n = (lg n ) 2 and lg lg n = lg(lg n ). H n is the n th harmonic number and H n = n i =1 1 /i ln n + 0 . 577215 ... . F n is the n th Fibonacci number and satisfies the recurrence F n = F n- 1 + F n- 2 with F = ,F 1 = 1. It can be verified by induction (try it!) that F n = ( n- (- 1 / ) n ) / 5 where = (1 + 5) / 2 is the golden ratio. 1. (10pts) True/False questions on background. 2. (25pts) Asymptotics. 3. (25 pts) Basic recurrences. 4. (40pts) Euclids algorithm for finding the greatest common divisor (gcd) of two non-negative numbers a,b is the following. Algorithm Euclid ( a,b ): 1: If ( b = 0) 2: return a 3: Else 4: return Euclid ( b,a mod b ) Prove via induction that the algorithm correctly computes the gcd of a,b . Also prove that the running time of the algorithm is polynomial in the input size. Note that the input size is (log a + log b ). Assume that the mod operation along with other basic arithmetic operations take constant time. Hint: For both parts think about how a + b is changing in each recursive call. A slow version of the Euclid algorithm is the following....
View Full Document

This note was uploaded on 04/18/2011 for the course CS 473 taught by Professor Chekuri,c during the Spring '08 term at University of Illinois, Urbana Champaign.

Page1 / 4

hw_0_soln - CS 473: Algorithms, Fall 2010 HW 0 (due...

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

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