1 / 8

CSCI 2100B Tutorial 3 Complexity Analysis

CSCI 2100B Tutorial 3 Complexity Analysis. Zhiwei Zhang. Complexity Analysis. Big - Oh Notation: The definition : if and only if there exists positive constants and such that for all . The implication :

Télécharger la présentation

CSCI 2100B Tutorial 3 Complexity 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. CSCI 2100B Tutorial 3Complexity Analysis Zhiwei Zhang

  2. Complexity Analysis • Big - Oh Notation: • The definition: • if and only if there exists positive constants and such that for all . • The implication: • means it cares a large size of data values -- larger than some given number . • means that is smaller than a constant time of the simplified function .

  3. Big - Oh Notation The definition: if and only if there exists positive constants and such that for all . Example1: g(n) = 3*g(n) = O() Reason: By choosing c = 4 and n0 = 2, for all values of N greater than 2: 3 * N2 + 3 <= 4 * N2

  4. Big - Oh Notation g(n) = 3*g(n) = O() g(n) = O() ??? By choosing c = 1 and = 4, g(n) <=

  5. Big - Oh Notation The most important factor of a function is a function which grows fastest. Suppose . In general, . Proof: , for . Example: 0.001 To proof this, we must prove it by the definition of Big Oh

  6. Big - Oh Notation • if and only if there exists positive constants and such that for all . • if there does not exist any positive constants and such that for all . • How to prove this:

  7. Big - Oh Notation • Example: Show that the Big-Oh for g(n) = + 7*n +2 is not O(n) Proof: So there does not exist any positive constants and such that for all .

  8. Big - Oh Notation • More Exercise:

More Related