Question: ALGORITHMS AND PROGRAMMING TECHNIQUES Q2: (10 Pts.) A. In each of the following situations, indicate whether f= O(g), or f= 2(g), or both f=lg). 1.
ALGORITHMS AND PROGRAMMING TECHNIQUES
Q2: (10 Pts.) A. In each of the following situations, indicate whether f= O(g), or f= 2(g), or both f=lg). 1. f(n)=n - 100 and g(n)=n-200. 2. f(n)=n1/2 and g(n)=n2/3. 3. f(n)= 100n +logn and g(n)=n +(logn)2. 4. f(n) = 10 logn and g(n)=log(n2). 5. f(n)=n2/logn and g(n)=n(logn). B. For this code answer the following ALGORITHM Mystery (n) S = 0 fori 1 to n do st S + i*i Return s (a) What does the algorithm computes? (6) Write the running time for each line, and derive the exact time? (c) What is the basic operation? (d) What is the efficiency class of this algorithm? (e) Can we do better algorithm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
