{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

review_midterm

# review_midterm - NOTE As you may have noticed we use a lot...

This preview shows pages 1–2. Sign up to view the full content.

NOTE: As you may have noticed, we use a lot of examples and diagrams in the lectures. So email is not an effective method to answer questions related to course material. Please DO NOT ask how to solve the following problems via email. Come to the office hours instead. 1. Order the following running time θ bounds by asymptotic growth rate in nondescending order. Indicate equality, if any. N 2 , 2 N , 25, Nlg(lgN), Nlg(N 2 ), N 2 lgN, N 3 , NlgN, and N! . 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) b. T(N) = N + T(N-3) c. T(N) = N 2 + T(N-1) 3. Perform a worst-case analysis of each of the following fragments and give a θ bound for the running time: a. sum = 0; for (int i = 0; i < N; i++) for (int j = 0; j < i * i; j++) for (int k = 0; k < j; k++) sum++; b. sum = 0; for (int i = 0; i < N; i++) for (int j = 0; j < i * i; j++) if (j % i == 0) { for (int k = 0; k < j; k++) sum++; } 4. Mergesort does have a worst-case time of

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

review_midterm - NOTE As you may have noticed we use a lot...

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

View Full Document
Ask a homework question - tutors are online