0

Hi I solved a question with recursion tree method. Then I reached the below equatition. n ∑ 3^(i-1)(n - (i - 1)) i=1

I need to find asymptotic upper bound for that equation. Any help would be appreciated.

trial
  • 19
  • 1
  • 6

2 Answers2

1

Wolfram Alpha is a great tool for this: https://www.wolframalpha.com/input/?i=sum(3%5E(i-1)(n+-+i+%2B+1)+for+i+%3D+1..n)

That tool simplifies the sum to: (-2n + 3^(n+1) - 3)/4.

In terms of big-O, that's O(3^n).

Paul Hankin
  • 54,811
  • 11
  • 92
  • 118
  • Paul Hankin: Do you think this O(3^n) is correct. I could not verify it with substitution method. – trial Mar 22 '17 at 20:40
  • If so what is the lower order term for 3^n ? – trial Mar 22 '17 at 20:52
  • I'm sorry, I don't understand what you're asking. I don't know what the substitution method is, nor what you mean by the lower order term. – Paul Hankin Mar 22 '17 at 21:07
  • (3^(n+1)-3-2n)/4 is certainly O(3^n), since it's immediate that it's less than 3/4 * 3^n, just by discarding the negative terms. – Paul Hankin Mar 22 '17 at 21:21
0

Let u(n) = 3^(n-1) + 2*3^(n-2) + ... + n, then
u(n+1) = (3^n + 3^(n-1) + ... + 1) + 3^(n-1) + 2*3^(n-2) + ... + n = (3^(n+1)-1)/2 + u(n) = 3*u(n) + n + 1 u(n) = (3^(n+1) - 2n - 3) / 4.

Abstraction
  • 1,108
  • 11
  • 25