1 / 11

Growth of Functions: Asymptotic Notations Direct Address Tables Hashing

Growth of Functions: Asymptotic Notations Direct Address Tables Hashing. מושגים O   (Asymptotic Notation). הגדרה : T(n)=O(g(n)) אם קיים n 0 וקבוע C>0 כך שלכל n  n 0 מתקיים T(n) Cg(n) דוגמא : 4 n 100+ =O(n) 4n+100  Cn C4+100/n n 0 =100 , C=5.

terra
Download Presentation

Growth of Functions: Asymptotic Notations Direct Address Tables Hashing

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. Growth of Functions: Asymptotic Notations • Direct Address Tables • Hashing

  2. מושגים O(Asymptotic Notation) הגדרה: T(n)=O(g(n))אם קיים n0 וקבוע C>0 כך שלכל n  n0מתקיים T(n)Cg(n) דוגמא: 4n100+=O(n) 4n+100  Cn C4+100/n n0=100 , C=5

  3. מושגים Oמהו הנכון? 3n+1 = O(n2) (n+1)2=O(n2) (n+1)2=O(n) 8=O(1) log(n)=O(n) nlog(n)=O(n)

  4. מושגים O(Asymptotic Notation) הגדרה: T(n)=  (g(n))אם קיים n0 וקבוע C>0 כך שלכל n  n0מתקיים T(n)Cg(n) דוגמא: 4n100+= (n) 4n+100 Cn C  4+100/n n0=1 , C=4

  5. מושגים Oמהו הנכון? 3n+1 = (n2) (n+1)2= (n2) (n+1)2= (n) 8= (1) log(n)= (n) nlog(n)= (n)

  6. מושגים O(Asymptotic Notation) הגדרה: T(n)= (g(n))אם קיים n0 וקבועים C1,C2>0 כך שלכל n  n0מתקיים C1g(n)  T(n)C2g(n) דוגמא: 4n100+= (n) C1 n  4n+100 C2n C24+100/n C1 4+100/n n0=100 , C2=5, C1=4

  7. מושגים Oמהו הנכון? 3n+1 =  (n2) (n+1)2=  (n2) (n+1)2=  (n) 8=  (1) log(n)=  (n) nlog(n)=  (n)

  8. תכונות של O A={O} 1) Transitivity: if f(n)=A(g(n)) and g(n)=A(h(n)) then f(n)=A(h(n)) 2) Reflexivity: f(n)=A(f(n)) 3) Symmetry: if f(n)= (g(n)) then g(n)= (f(n)) 3’) Transpose symmetry: if f(n)= O(g(n)) then g(n)=  (h(n))

  9. דוגמא:

  10. דוגמא:

  11. דוגמא: פעולות על רשימה. זמני ריצהL={x1,x2,…, xn} ListSearch(value):Ptr Ptr x  Head() While (not Outside(x)) and Key(x) <> value x  Next(x) (worst case:) If Outside(x)  (n) Return nil Else Return x

More Related