hw3 - CS170(Fall 2014 Solutions for Homework 3 Krishna Parashar SID 23664968 cs170-hm Collaborators None 1 Practice with recurrence relations(a F(n

# hw3 - CS170(Fall 2014 Solutions for Homework 3 Krishna...

• Homework Help
• 7
• 50% (10) 5 out of 10 people found this document helpful

This preview shows page 1 - 3 out of 7 pages.

CS170 (Fall 2014) – Solutions for Homework 3 Krishna Parashar, SID 23664968, cs170-hm , Collaborators: None. September 19, 2014 1. Practice with recurrence relations (a) F ( n ) = θ ( n ) (b) G ( n ) = θ (log n ) (c) H ( n ) = θ (log n ) (d) I ( n ) = θ ( n ) (e) J ( n ) = θ ( n 0 . 5 ) (f) K ( n ) = θ ( n ) (g) L ( n ) = θ ( n 2 . 4 ) (h) M ( n ) = θ (2 n ) 1
CS170–Fall 2014 Homework 3 Krishna Parashar, cs170-hm 2 2. Procedural Terrain Generation (a) Everytime we call our Algorithm we branch into 4 factors, and we make each of these problems of size n/ 2 All the cool kids know that we can use a Recurrence Relations to get this super awesome relation : T ( n ) = 4 T n 2 + O (1) And then, oh gentle reader, we apply the Master Theorem to get these values: a = 4 , b = 2 , d = 0 We use these values for our logrithm: log 2 4 = 2 Since, according to the Master Theorem, it is trivial to prove that our value of 2 is greater than 0 (it is after all how numbers work), and thus we end up with the solution: θ ( n 2 ) (b) Unfortunetly, even if we could reduce the other operations (such as the computation