s11b_midterm_review

s11b_midterm_review - Midterm Review CSE 2011 Winter 2011...

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

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

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

View Full DocumentRight Arrow Icon
Running Times of Loops Nested for loops: c If the exact number of iterations of each loop is known, multiply the numbers of iterations of the loops. c 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 c Could be just a hidden “for" or “while” loop. r See “Tail Recursion” slide. r “Unravel” the hidden loop to count the number of iterations. c Logarithmic r Examples: binary search, exponentiation, GCD c Solving a recurrence r Example: merge sort, quick sort 4
Background image of page 2
Recursion Know how to write recursive functions/methods: c Recursive call
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/04/2011 for the course CSE 2011 taught by Professor Someone during the Spring '10 term at York University.

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 Right Arrow Icon
Ask a homework question - tutors are online