{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

s11b_midterm_review

# s11b_midterm_review - Midterm Review CSE 2011 Winter 2011...

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

Midterm Review CSE 2011 Winter 2011 1 17 February 2011 Algorithm Analysis circle6 Given an algorithm, compute its running time in terms of O, , and Θ (if any). ring2 Usually the big-Oh running time is enough. circle6 Given f(n) = 5n + 10, show that f(n) is O(n). ring2 Find c and n 0 circle6 Compare the grow rates of 2 functions. circle6 Order the grow rates of several functions. ring2 Use slide 14. ring2 Use L’Hôpital’s rule. 2

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

View Full Document
Running Times of Loops Nested for loops: circle6 If the exact number of iterations of each loop is known, multiply the numbers of iterations of the loops. circle6 If the exact number of iterations of some loop is not known, “open” the loops and count the total number of iterations. 3 Running Time of Recursive Methods circle6 Could be just a hidden “for" or “while” loop. ring2 See “Tail Recursion” slide. ring2 “Unravel” the hidden loop to count the number of iterations. circle6 Logarithmic ring2 Examples: binary search, exponentiation, GCD circle6 Solving a recurrence ring2 Example: merge sort, quick sort 4
Recursion Know how to write recursive functions/methods: circle6 Recursive call ring2

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 / 9

s11b_midterm_review - Midterm Review CSE 2011 Winter 2011...

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

View Full Document
Ask a homework question - tutors are online