Asg1 - ASSIGNMENT 1 CSE2011 Name Wizda Nisar Student 209772187 Date 3rd February 2011 CSE 2011 1 Show that a 2N 1 is O(2N ASSIGNMENT 1 FEBRUARY 2ND

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
ASSIGNMENT 1 CSE2011 Name: Wizda Nisar Student #: 209772187 Date: 3 rd February, 2011
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
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(N-1) T(N-1) = 2((N-1)-1) + T((N-1)-1)
Background image of page 2
= 2N – 3 + T(N – 2) T(N-2) = 2((N-2)-1) + T ((N-2)-1) = 2N – 5 + T(N – 3) T(N-3) = 2((N-3)-1) + T ((N-3)-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)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Now, 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,
Background image of page 4
Image of page 5
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.

Page1 / 9

Asg1 - ASSIGNMENT 1 CSE2011 Name Wizda Nisar Student 209772187 Date 3rd February 2011 CSE 2011 1 Show that a 2N 1 is O(2N ASSIGNMENT 1 FEBRUARY 2ND

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online