Given two functions T1(n) = 20n and T2(n) = n2 +10n−200 and assuming integer n > 0,
what is the minimum value of n such that T1(n) < T2(n)?
Answer:
T1(n) = 20n
T2(n) = n2 + 10n - 200
T1(n) < T2(n)
20n < n2 + 10n - 200
n2 - 20n - 200 > 0
(x - 27.32)(x + 7.32) > 0
SO, x > 27.32 or x > -7.32
But, since x > 0,
The minimum value of x for T1(n) < T2(n) is 27
1. (10 points) Write an efficient iterative (i.e., loop-based) function Fibonnaci(n) that returns the nth Fibonnaci number. By definition Fibonnaci(0) is 1, Fibonnaci(1) is 1, Fibonnaci(2) is 2, Fibonnaci(3) is 3, Fibonnaci(4) is 5, and so on. Your function may only use a constant amount of memory (i.e. no auxiliary array). Argue that the running time of the function is Θ(n), i.e. the function is linear in n. 2. (10 points) Order the following functions by growth rate: N, \N,...
Suppose that we have two algorithms A1 and A2 for solving the same problem. Let T1(n) be the worst-case time complexity of A1 and T2(n) be the worst-case time complexity of A2. We know that: T(1)=1 T1(n)=15*T1(n/2)+n^2, n>1 T2(1)=1 T2(n)=80*T2(n/3)+20n^3,n>1 a. Use the master method to decide T1(n) b. Use the master method to decide T2(n) c. Which algorithms is more efficient? Why?
Review Part A The position of a particle as a function of time is given by T (6.4i 24 j)t2 m, where t is in seconds What is the particle's distance from the origin at t = 0 s? Express your answer as an integer and include the appropriate units. Value Units Submit Part B the origin at t1-29s What is the particle's distance from t Express your answer to two significant figures and include the appropriate units. Value Units...
2. The table below holds MIPS assembly code fragments with different branch instructions LOOP addi $s2. $s2. 2 subi $t1. st1. 1 bne t1. 0. LOOP DONE: LOOP: it st2. $0. stl beq t2. 0. DONE addi $s2. Ss2. 2 LOOP DONE: For the loops written in MIPS assembly in the above table, assume that the register Şt1 is initialized to the value of 10. What is the value in register $s2 assuming that $s2 initially has a value of...
Design algorithms for the following functions and describe them in pseudocode. If you use auxiliary functions, describe them in pseudocode as well. Evaluate the runtime efficiency of your algorithms and express it in O( ) notation. a. Union(T1.root, T2.root): T1.root and T2.root point to the roots of two B-trees. The function returns a pointer to the root of a B-tree containing every key contained in T1 or T2. b. Intersection(T1.root, T2.root): T1.root and T2.root point to the roots of two...
A) The following code fragment takes as input a number in t1 and produces a value in register $s2. Assume that initially $s2 equals zero. Line Loop: addi $t2, $zero, 10 2 Loop2: addi$s2, $s2, 2 3 subi $t2, $t2, 1 4 bne $t2, $zero, Loop2 5 subi $t1,$t1, 1 6 bne $t1, $zero, Loop For each of the following problems, justify your answers and show your calculations clearly. Final answers without justifications are not accepted. What is the final...
7. [4] (Big-O-Notation) What is the order of growth of the following functions in Big-o notation? a. f(N) = (N® + 100M2 + 10N + 50) b. f(N) = (10012 + 10N +50) /N2 c. f(N) = 10N + 50Nlog (N) d. f(N) = 50N2log (n)/N
What is the order of the following growth function? t(n)= 5 nlog n + 20n +20 O(log n) Oin log n) o O(n2) 0(1)
Exercise 11.3 Consider the following duopoly model. There are two firms sup- plying a market where demand is given by p(Q)- a-bQ. Firm i produces qi units of output and so the total level of production is q1q2. Both firms face the same constant marginal cost, so the cost of producing qi for firm i įs cqỉ. Thus the profit functions of firms 1 and 2 respectively, are given by: (a) Suppose that each firm takes the output of the...
Needs to be explained also, like what method you used to compare the growth rate. Thank you 4) Order the following functions by growth rate. Indicate which functions grow at the same rate (15 points) N, N2, log N, N log N, log(N2), log2 N, N log2N, 2, 2N, 37, N2 log N, 5logN, N3, 10N log N2