This preview shows pages 1–5. Sign up to view the full content.
ASSIGNMENT 1
CSE2011
Name: Wizda Nisar
Student #: 209772187
Date: 3
rd
February, 2011
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document CSE 2011
ASSIGNMENT 1
FEBRUARY 2
ND
, 2011
1. Show that
a. 2
N+1
is O(2
N
)
Since, F(N) < = C.g(N) when N > = n
2
N+1
< = C.(2
N
)
2
N+1
< = 2(2)
N
So, C = 2 and n = 1.
b. N
2
/2 + N + 10 is Ω(N
2
)
Since, F(N) > = C.g(N)
N
2
/2 + N + 10 > = (N
2
)
2
/2 + N
2
+ 1
N
2
/2 + N + 10 > = ½ + 1 + 10
N
2
/2 + N + 10 > = 23/2 or (11.5)
So, C = 23/2 and n > = 1.
c. N
1.5
grows faster than NlogN using L'Hopital's rule.
/g(N)
= N
1.5
/ NlogN
= N
√N/ NlogN
= (
√N)
2
/(logN)
2
= N/ log
2
N
Therefore, this proves that N grows faster than log
2
N.
d. log
k
N is o(N) (small o) for any constant k.
Hint
: Use L'Hopital's rule.
/g(N)
= log
k
N/N
= klogN/N
= (klogN/k)/N/K
= (logN)/N/k
2.
Solve the following recurrences by obtaining a θ bound for T(N) given that T(1) =
θ(1):
a. T(N) = 2N  1 + T(N1)
T(N1) = 2((N1)1) + T((N1)1)
= 2N – 3 + T(N – 2)
T(N2) = 2((N2)1) + T ((N2)1)
= 2N – 5 + T(N – 3)
T(N3) = 2((N3)1) + T ((N3)1)
= 2N – 7 + T(N – 4)
Now, sub T(N – 1) equation in the original question.
T(N) = 2N – 1 + (2N – 3 + T (N – 2))
= 4N – 4 + T(N – 2)
Sub T(N – 2) equation.
.
T(N) = 2N – 1 + (2N – 5 + T(N – 3)
= 6N – 9 + T(N – 3)
Sub T(N – 3) equation.
.
T(N) = 2N – 1 + (2N – 7 + T(N – 4)
= 8N – 16 + T(N – 4)
Factoring out above 3 equations:
2(2N – 2 + T(N – 2)), 3(2N – 3 + T(N – 2)), 4(2N – 4 + T(N – 2))
Therefore, the pattern is:
K + 1 (2N – (K + 1) + T (N – (K + 1)
Now we find T(1) =
θ
(1) = 1:
N – (K + 1)
this should equal to 1.
N – K – 1 = 1
– K = 2 – N
Therefore,
θ
= K = (N – 2)
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentNow, sub K value into the pattern:
K + 1 (2N – (K + 1) + T (N – (K + 1)
=
(N – 2) + 1 (2N – ((N – 2) + 1) + T (N – ((N – 2) +1)
= (N – 2 +1) (2N – N + 1) + T (N – N + 1)
= (N – 1) (N + 1) + T (1)
= N
2
+ N – N – 1 + T (1)
= N
2
+ T(1)
Therefore,
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 02/13/2011 for the course CSE 2011 taught by Professor Someone during the Winter '10 term at York University.
 Winter '10
 someone
 Computer Science

Click to edit the document details