Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. An algorithm coded in Python usually runs slightly faster than the same algor

ID: 3669322 • Letter: 1

Question

1. An algorithm coded in Python usually runs slightly faster than the same algorithm coded in C. A. True B. False
2. When analyzing an algorithm, one must be careful to determine that any instructions do not hide a loop that depends on a variable problem size. A. True B. False
3. The work of a(n) ____ time algorithm grows at a rate of n^k, where k is a constant greater than 1. A. exponential B. polynomial C. logarithmic D. constant
4. Although recursive Fibonacci is elegant in its design, there is a less beautiful but much faster version that uses a loop to run in linear time. A. True B. False
5. Whenever the amount of work of an algorithm is expressed as a polynomial, we focus on one term as dominant. A. True B. False
6. The time() function of the time module can be used to track the running time of a program. A. True B. False
7. Some algorithms require more memory as the problem size gets larger. A. True B. False
8. The constant of proportionality involves the terms and coefficients that are usually ignored during big-O analysis. A. True B. False
9. Algorithms with linear behavior do less work than algorithms with quadratic behavior for most problem sizes n. A. True B. False
10. The worst-case complexity of binary search is ____. A. O(n2) B. O(log2n) C. O(n) D. O(1)
1. An algorithm coded in Python usually runs slightly faster than the same algorithm coded in C. A. True B. False
2. When analyzing an algorithm, one must be careful to determine that any instructions do not hide a loop that depends on a variable problem size. A. True B. False
3. The work of a(n) ____ time algorithm grows at a rate of n^k, where k is a constant greater than 1. A. exponential B. polynomial C. logarithmic D. constant
4. Although recursive Fibonacci is elegant in its design, there is a less beautiful but much faster version that uses a loop to run in linear time. A. True B. False
5. Whenever the amount of work of an algorithm is expressed as a polynomial, we focus on one term as dominant. A. True B. False
6. The time() function of the time module can be used to track the running time of a program. A. True B. False
7. Some algorithms require more memory as the problem size gets larger. A. True B. False
8. The constant of proportionality involves the terms and coefficients that are usually ignored during big-O analysis. A. True B. False
9. Algorithms with linear behavior do less work than algorithms with quadratic behavior for most problem sizes n. A. True B. False
10. The worst-case complexity of binary search is ____. A. O(n2) B. O(log2n) C. O(n) D. O(1)
1. An algorithm coded in Python usually runs slightly faster than the same algorithm coded in C. A. True B. False
2. When analyzing an algorithm, one must be careful to determine that any instructions do not hide a loop that depends on a variable problem size. A. True B. False
3. The work of a(n) ____ time algorithm grows at a rate of n^k, where k is a constant greater than 1. A. exponential B. polynomial C. logarithmic D. constant
4. Although recursive Fibonacci is elegant in its design, there is a less beautiful but much faster version that uses a loop to run in linear time. A. True B. False
5. Whenever the amount of work of an algorithm is expressed as a polynomial, we focus on one term as dominant. A. True B. False
6. The time() function of the time module can be used to track the running time of a program. A. True B. False
7. Some algorithms require more memory as the problem size gets larger. A. True B. False
8. The constant of proportionality involves the terms and coefficients that are usually ignored during big-O analysis. A. True B. False
9. Algorithms with linear behavior do less work than algorithms with quadratic behavior for most problem sizes n. A. True B. False
10. The worst-case complexity of binary search is ____. A. O(n2) B. O(log2n) C. O(n) D. O(1)

Explanation / Answer

1. False: There are two ways to answer reason this first if we are talking about algorithm complexity it is independent of language of implementation. Another Python is build over C which is much slower than C.

2. True. Loops hide the overload of computation.

3. Polynomial.

4. True. Consider following pseudo code.

fib[0] = fib[1] = 1

for i = 2; i < N; ++i

fib[i] = fib[i - 1] + fib[i - 2]

5. True. O(n3 + n2 + n) = O(n3). Why? At very large values of n, n2 + n will be much smaller than n3 which can be ignored.

6. True. Refer code:

import time

start = time.time()

// run your code

print(time.time() - start)

7. True. Algorithm dependent upon previous values for computaion require more memory when problem size increases.

8. True. Constants of proportionality generally turn out to be small values therefore they can be ignored.

9. True. Linear time algortihms will require O(n) steps where as quadratic will require O(n2) steps.

10. The worst case complexity of binary search is O(log2n)