recitation02

# recitation02 - MIT OpenCourseWare http/ocw.mit.edu 6.006...

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

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

View Full Document

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

View Full Document

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

View Full Document

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

View Full Document

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

View Full Document

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.

Unformatted text preview: MIT OpenCourseWare http://ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms . 6.006 Recitation Build 2008.4 Outline • Asymptotic Notation • Merge-Sort • Python Cost Model • (maybe) docdist{5,6}.py Asymptotic Notation F1 F2 F3 f1: 1,000 * n 0.635 500,000,000 375,000,000 f2: n 250,000,000 125,000,000 f3: 10,000 * n 0.5 0 0 80mm 190mm 310mm Asymptotic Notation f 1.1 * g • f = O(g) Asymptotic Notation f 0.9 * g • f = Ω (g) Asymptotic Notation f 0.9 * g 1.1 * g • f = Θ (g) Asymptotic Drowning • lg(n 100 ) = 100 * lg(n) = Θ (lg(n)) • lg(n 0.1 ) = 0.1 * lg(n) = Θ (lg(n)) • lg 5 (n) = lg(n) / lg(5) = Θ (lg(n)) • n lg(5) = n 2.3219... so n 2 < n lg(5) < n 3 Asymptotic Headaches • 10 80 (atoms in the universe) • lg log5 (lg lg100 n) • (20n) 7 • 5 lg3 n 3 + 10 80 n 2 + (lg3)n 3.1 + 6006 • lg( N ) N/2 Stirling Banishes the Evil • N! ~= sqrt(2 π N) * ((N/e) ^ N) N • Substitute in lg( N/2 ) • Reduce terms, obtain O(N) Binary Search for 23 1 3 4 9 11 15 20 24 29 34 38 1 3 4 9 11 15 20 24 29 34 38 1 3 4 9 11 15 20 24 29 34 38 1 3 4 9 11 15 20 24 29 34 38 1 3 4 9 11 15 20 24 29 34 38 Divide and Conquer...
View Full Document

{[ snackBarMessage ]}

### Page1 / 34

recitation02 - MIT OpenCourseWare http/ocw.mit.edu 6.006...

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

View Full Document
Ask a homework question - tutors are online