Question

(a) Show that if f(n) = O(f′(n)) and g(n) = O(g′(n)) then f(n) + g(n) =O(f′(n)...

(a) Show that if f(n) = O(f′(n)) and g(n) = O(g′(n)) then f(n) + g(n) =O(f′(n) + g′(n)).    (b)Solve T (n) = T (n − 1) + n2 using the recurrence tree method. In particular, what is big-O of T(n).

Homework Answers

Answer #1

a)

Since f(n) = O(f'(n)), this implies

0 <= f(n) <= c1 * f'(n) where c1 is a positive constant --------------> (1)

Since g(n) = O(g'(n)), this implies

0 <= g(n) <= c2 * g'(n) where c2 is a positive constant -------------> (2)

adding 1 and 2, we get

0 <= f(n) + g(n) <= c1 * f'(n) + c2 * g'(n)

0 <= f(n) + g(n) <= c3 * (f'(n) + g'(n)) where c3 is greater than c1 and c2.

Hence, f(n) + g(n) = O(f'(n) + g'(n))

2)

T(n) - T(n-1) = n2

=> T(1) - T(0) = 1

=> T(2) - T(1) = 4

=> T(3) - T(2) = 9

=> T(4) - T(3) = 16

.......

=> T(n) - T(n-1) = n2

Summing every equations, we get

T(n) - T(0) = 1 + 4 + 9 + 16 + .... + n2 = n(2n+1)(n+2)/6

=> T(n) = T(0) + O(n3) = O(n3​​​​​​​)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
True or False...Provide your reasons If f(n) =o(g(n)), then f(n)=O(g(n)) If f(n) =O(g(n)), then f(n) ≤...
True or False...Provide your reasons If f(n) =o(g(n)), then f(n)=O(g(n)) If f(n) =O(g(n)), then f(n) ≤ g(n) 3.  If 1<a=O(na), then f(n)=O(nb) 4. A and B are two sorting algorithms. If A is O(n2) and B is O(n), then for an input of X integers, B can sort it faster than A.
Master Theorem: Let T(n) = aT(n/b) + f(n) for some constants a ≥ 1, b >...
Master Theorem: Let T(n) = aT(n/b) + f(n) for some constants a ≥ 1, b > 1. (1). If f(n) = O(n logb a− ) for some constant > 0, then T(n) = Θ(n logb a ). (2). If f(n) = Θ(n logb a ), then T(n) = Θ(n logb a log n). (3). If f(n) = Ω(n logb a+ ) for some constant > 0, and af(n/b) ≤ cf(n) for some constant c < 1, for all large n,...
Use the substitution method to show that for the recurrence equation: T( 1 )=2 T( n...
Use the substitution method to show that for the recurrence equation: T( 1 )=2 T( n )=T(n-1) + 4n the solution is T( n )= Big Theta( n2 )
1a. Use the substitution method to prove that, if T(n) = T(n/3) + 5, then T(n)...
1a. Use the substitution method to prove that, if T(n) = T(n/3) + 5, then T(n) = O(log n). Hint: do not forget the inductive assumption. 1b. Given the recurrence T(n) = 2T(b √ nc) + n, determine the big-Θ height of its associated recursion tree. 1c. For the recurrence in part b, provide a mathematical formula for the total work that is performed at depth 4 of the associated recursion tree. Hint: the root has depth equal to zero.
1.Let f and g be two functions such that f(n)/g(n) converges to a positive value less...
1.Let f and g be two functions such that f(n)/g(n) converges to a positive value less than 1 as n tends to infinity. Which of the following is necessarily true? Select one: a. g(n)=Ω(f(n)) b. f(n)=Ω(g(n)) c. f(n)=O(g(n)) d. g(n)=O(f(n)) e. All of the answers 2. If T(n)=n+23 log(2n) where the base of the log is 2, then which of the following is true: Select one: a. T(n)=θ(n^2) b. T(n)=θ(n) c. T(n)=θ(n^3) d. T(n)=θ(3^n) 3. Let f and g be...
Find the big-O, big-Omega of the following functions (show steps please) a) f(n) = 5n^2 +...
Find the big-O, big-Omega of the following functions (show steps please) a) f(n) = 5n^2 + 1 b) f(n)= (nlogn+1)*(n+1)
Assume that f(n) = O(g(n)). Can g(n) = O(f(n))? Are there cases where g(n) is not...
Assume that f(n) = O(g(n)). Can g(n) = O(f(n))? Are there cases where g(n) is not O(f(n))? Prove your answers (give examples for the possible cases as part of your proofs, and argue the result is true for your example).
Let f,g be positive real-valued functions. Use the definition of big-O to prove: If f(n) is...
Let f,g be positive real-valued functions. Use the definition of big-O to prove: If f(n) is O(g(n)), then f2(n)+f4(n) is O(g2(n)+g4(n)).
Solve the following recurrences: (a) T(n) = T(n=2) + O(n), with T(1) = 1. Solve this...
Solve the following recurrences: (a) T(n) = T(n=2) + O(n), with T(1) = 1. Solve this two times: one with the substitution method and one with the master theorem from CLRS. When you use the master theorem, carefully show the values for the parameters a; b. For the following cases you can use your preferred method. In either case, show your work: (b) T(n) = 2T(n/2) + O(1), T(1) = 1. (c) T(n) = 3T(n/2) + O(1), T(1) = 1....
which of the following are true: (1) f(n) = o(g(n)), (2) f(n) = Θ(g(n)), or (3)...
which of the following are true: (1) f(n) = o(g(n)), (2) f(n) = Θ(g(n)), or (3) g(n) = o(f(n)) for each function. Justify briefly your choices. 1. f(n) = 22n, g(n) = 3n + logn. 2. f(n) = √n + log(nn) + 500, g(n) = n.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT