Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Assignment 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

COT6405 Analysis of Algorithms Spring 12

Assignment 1
Posted on Jan 25, due on Feb 8 Each problem is worth 10 points, for a maximum total of 50 points. 1. Find a notation in terms of n for the number of times the statement x = x + 1 is executed in the segment: i=1 while ( i < n2) x=x+1 i = 3i 2. Arrange the following functions in ascending order of growth rate. That is, if function g(n) immediately follows function f(n) in your list, then it should be the case that f(n) = O(g(n)).

1 f 1 ( n) = 3 f 2 (n) = n(log 2 n) 3 f 3 (n) = 8n 3 f 4 ( n) = n 5 + 5 n f 5 (n) = n 2 50n 100 f 6 (n) = 8 log 2 n 1000


3. Use the formal definitions to show that: 2n2 n + 3 = (n). Find some positive values c and n0. 3n2 - 4n + 4 = o( n3) . Find some positive value n0. 4. Solve the following recurrences using the Master Theorem: a. T(n) = 2T(n/4) + n n b. T(n) = 15T(n/3) + nlgn 5. Amortized analysis (Accounting method) : CLRS 17.2-1 page 458 Suppose we perform a sequence of stack operations on a stack whose size never exceeds k. After every k operations, we make a copy of the entire stack for backup purposes. Use the accounting method to show that the cost of n stack operations, including copying the stack is O(n) by assigning suitable amortized costs to the various stack operations.

You might also like