1 / 16

CSE 326: Data Structures Lecture #2 Asymptotic Analysis

CSE 326: Data Structures Lecture #2 Asymptotic Analysis. Steve Wolfman Winter Quarter 2000. Today’s Outline. How Homework Works Forming Teams Things Steve Didn’t Finish on Wednesday (Cross Lists) Proofs Asymptotic Analysis Quiz (don’t be scared!). Homework. Quiz on Friday

maggiew
Download Presentation

CSE 326: Data Structures Lecture #2 Asymptotic Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 326: Data StructuresLecture #2Asymptotic Analysis Steve Wolfman Winter Quarter 2000

  2. Today’s Outline • How Homework Works • Forming Teams • Things Steve Didn’t Finish on Wednesday (Cross Lists) • Proofs • Asymptotic Analysis • Quiz (don’t be scared!)

  3. Homework • Quiz on Friday • lasts about 10 minutes in class • what you get right counts toward homework • what you get wrong becomes short answer for homework • quiz returned on Monday • Homework due Wednesday • turn in at the start of class

  4. Teams

  5. Proof by... • Counterexample • show an example which does not fit with the theorem • QED (the theorem is disproven) • Contradiction • assume the opposite of the theorem • derive a contradiction • QED (the theorem is proven) • Induction • prove for a base case (e.g., n = 1) • assume for an anonymous value (n) • prove for the next value (n + 1) • QED

  6. Example Proof by Induction • A number is divisible by 3 iff the sum of its digits is divisible by three • Base Case:

  7. Example Continued • Induction Hypothesis:

  8. Example Still Continued • Induction Step:

  9. Asymptotic Analysis • Find a student’s name in a class given her UWID

  10. Analysis of Algorithms • Analysis of an algorithm gives insight into how long the program runs and how much memory it uses • time complexity • space complexity • Analysis can provide insight into alternative algorithms • Input size is indicated by a number n (sometimes there are multiple inputs) • Running time is a function of n such as T(n) = 4n + 5 T(n) = 0.5 n log n - 2n + 7 T(n) = 2n + n3 + 3n • But...

  11. Asymptotic Analysis • Eliminate low order terms • 4n + 5  4n • 0.5 n log n - 2n + 7  0.5 n log n • 2n + n3 + 3n  2n • Eliminate coefficients • 4n  n • 0.5 n log n  n log n • n log n2 = 2 n log n  n log n

  12. Rates of Growth • Suppose a computer executes 1012 ops per second: 104s = 2.8 hrs 1018s = 30 billion years

  13. Order Notation • T(n)  O(f(n)) if there are constants c and n0 such that T(n)  c f(n) for all n  n0 • T(n)  (f(n)) if there are constants c and n0 such that T(n) c f(n) for all n  n0 • T(n)  (f(n)) if T(n)  O(f(n)) and T(n)   (f(n)) • T(n) o(f(n)) if T(n)  O(f(n)) and T(n)  (f(n)) • T(n) (f(n)) if T(n)  O(f(n)) and T(n)  (f(n))

  14. Examples 10,000 n2 + 25 n (n2) 10-10 n2(n2) n log n  O(n2) n log n (n) n3 + 4  o(n4) n3 + 4 (n2)

  15. To Do • Start Project I • Answer the Quiz questions you think you missed • Read chapters 1-3 in the book • Think about whether you like this homework format

  16. Coming Up • Asymptotic Analysis of Recursion • Priority Qs • First homework assignment due (January 12th) • First project due (January 14th) • A day off (January 17th)!

More Related