You are on page 1of 2

JAMIG, ANSELM JADE H.

N23

AS3

1. Compute the following sums.

1. 1+ 3 + 5 + 7 + . . . + 999

 ∑x = (x-2)2
=(999-2)2
=994,000

2. 2 + 4 + 8 + 16 + . . . + 1024

 ∑x = 2n+1-1
=211-1
=2046

2. Solve the following recurrence relations.

1. x(n) = x(n − 1) + 5 for n > 1, x(1) = 0

 x(n 1) = x(n-2) + 5
x(n) = x(n-2) + 5 + 5
= x(n-3) + 5 + 5 + 5
= x(n-i)+5i ∀i<n
= x(n (n-1)) + 5(n-1)
= 5(n-1)

2. x(n) = 3x(n − 1) for n > 1, x(1) = 4

 x(n)=3x(n 1)
= 3 x [4 x 3 (n-1)-1]
= 4 x 3n-1
= x(n)

3. x(n) = x(n − 1) + n for n > 0, x(0) = 0

 x(n-1) + n
[x(n-2) + (n-1)]+ n
= x(n-2) + (n-1) + n
n(n+1)
=x(0) + 1 + 2 + n =
2
x(n) = Ө(n2)

4.  x(n) = x(n/2) + n for n > 1, x(1) = 1 (solve for n = 2k)

 =x(2k-1) + 2k
=[x(2k-2) + 2k-1] + 2k
= x(2k-2) + 2k-1 +2k
=2k+1 - 1
=2x 2k - 1
=2n-1
x(n) = Ө(n)

You might also like