Download algorithms and programming exercise problem set with solutions and more Exercises Algorithms and Programming in PDF only on Docsity!
P P
Problem Set 1 Style guide and expectations: Please see the “Homework” part of the syllabus for guidance on what we are looking for in homework solutions. You should cite all sources you used outside of the course material. What we expect: Make sure to look at the “We are expecting’ blocks below each problem to see what we will be grading for in each problem! Exercises As with any homework problem you may ask the course staff for help. 0. Using the definition of big-O, formally prove the following statements. (a) 2VA+6 = OV). (b) 10” is not O(2”). [We are expecting: For each part, a rigorous (but short) proof, using the definition of o()] (a) Solution: 2/n+ 6 = O(n) if Sc, m > 0 such that 2\/n+ 6 < c/nVn > Mm. Vn> 1, 2/n+6 < 2/n+6/n = 8, therefore set m = 1 and c = 8. Feel free to pick other values for c and mg; as long as you can prove that 2\/n+6 < c/n Vn > mg for the values that you picked, your answer is correct. (b) Solution: Prove this by contradiction. That is, assume that 10" = O(2"), i.e. that 4c, m > 0 such that 10° < c2” Vn > no. From the inequality, we get: vn>m, @m,5"° 1m, 0 < logs(c)