23 views

Uploaded by Rajendranbehappy

Asymptotic Notations

- Manual on Rainfall Analysis For Storm Water Drainage Systems, Second Edition
- Wegener
- Numerical Method for engineers-chapter 17
- Complexity
- 90284-res-09
- Hunts Zy Man Ski
- Algo Analysis and Time Complexity
- Complexity Analysis 4,5,6
- _papaerumajuste
- MC Practice, 7.2-7.4
- A Guide to Algorithm Design Paradigms Methods and Complexity Analysis
- 22.Full
- Amath Olevel Revision Paper 1
- Unit 2 Organizer: Exponents and Logarithms
- Tips Physics
- index and log
- Lects5to8
- Revision Lesson 1.pdf
- 04-Arrays
- archi.pdf

You are on page 1of 8

Asymptotic notations

Algorithm Analysis

The amount of resources used by the algorithm

Space

Computational time

Running time:

The number of primitive operations (steps) executed before

termination

Order of growth

The leading term of a formula

Expresses the behavior of a function toward infinity

Asymptotic Notations

Describe the running time of an algorithm as n grows to

O notation: asymptotic less than: f(n) g ( n )

notation: asymptotic greater than: f(n) g ( n )

notation: asymptotic equality: f(n) = g(n)

Logarithms

In algorithm analysis we often use the notation log n without

specifying the base

Binary logarithm

lg n = log2 n

log x y = y log x

Natural logarithm

ln n = loge n

lg n = (lg n )

lg lg n = lg(lg n )

log

x

= log x log y

y

loga x = loga b logb x

a logb x =

x logb a

Asymptotic notations

Big O Notation

functions with a smaller or

same order of growth as g(n)

Examples

2n2 = O(n3): 2n2 cn3 2 cn c = 1 and n0= 2

n2 = O(n2): n2 cn2 c 1 c = 1 and n0= 1

1000n2+1000n = O(n2):

1000n2+1000n 1000n2+1000n2=2000n2 c=2000 and n0 = 1

n = O(n2): n cn2 cn 1 c = 1 and n0= 1

- notation

functions with a larger or same

order of growth as g(n)

Examples

5n2 = (n)

c, n0 such that: 0 cn 5n2 cn 5n2 c = 1 and n0 = 1

100n + 5 (n2)

c, n0 such that: 0 cn2 100n + 5

100n + 5 100n + 5n ( n 1) = 105n

cn2 105n n(cn 105) 0

Since n is positive cn 105 0 n 105/c

contradiction: n cannot be smaller than a constant

n = (2n), n3 = (n2), n = (logn)

8

-notation

growth as g(n)

Examples

n2/2 n/2 = (n2)

n2 - n n2 n 0

c2=

n2 - n n2 - n * n ( n 2 ) = n2 c1=

6n3 (n2): c1 n2 6n3 c2 n2 only holds for: n c2 /6

n (logn): c1 logn n c2 logn

c2 n/logn, n n0 impossible

asymptotic bounds

100n + 5 100n + n = 101n 101n2

for all n 5

n0 = 5 and c = 101 is a solution

100n + 5 100n + 5n = 105n 105n2

for all n 1

n0 = 1 and c = 105 is also a solution

Must find SOME constants c and n0 that satisfy the asymptotic notation relation

11

Comparisons of Functions

Theorem:

f(n) = (g(n)) f = O(g(n)) and f = (g(n))

Transitivity:

f(n) = (g(n)) and g(n) = (h(n)) f(n) = (h(n))

Same for O and

Reflexivity:

f(n) = (f(n))

Same for O and

Symmetry:

f(n) = (g(n)) if and only if g(n) = (f(n))

Transpose symmetry:

f(n) = O(g(n)) if and only if g(n) = (f(n))

12

On the right-hand side

(n2) stands for some anonymous function in (n2)

2n2 + 3n + 1 = 2n2 + (n) means:

There exists a function f(n) (n) such that

2n2 + 3n + 1 = 2n2 + f(n)

2n2 + (n) = (n2)

No matter how the anonymous function is chosen on

the left-hand side, there is a way to choose the

anonymous function on the right-hand side to make

the equation valid.

13

Practical Complexity

250

f(n) = n

f(n) = log(n)

f(n) = n log(n)

f(n) = n^2

f(n) = n^3

f(n) = 2^n

0

1 2 3

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

14

Practical Complexity

500

f(n) = n

f(n) = log(n)

f(n) = n log(n)

f(n) = n^2

f(n) = n^3

f(n) = 2^n

0

1 2 3

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

15

Practical Complexity

1000

f(n) = n

f(n) = log(n)

f(n) = n log(n)

f(n) = n^2

f(n) = n^3

f(n) = 2^n

0

1

11

13

15

17

19

16

Practical Complexity

5000

4000

f(n) = n

f(n) = log(n)

3000

f(n) = n log(n)

f(n) = n^2

2000

f(n) = n^3

f(n) = 2^n

1000

0

1

11

13

15

17

19

17

For each of the following pairs of functions, either f(n) is

O(g(n)), f(n) is (g(n)), or f(n) = (g(n)). Determine

which relationship holds.

f(n) = (g(n))

f(n) = log n2; g(n) = log n + 5

f(n) = n; g(n) = log n2

f(n) = (g(n))

f(n) = O(g(n))

f(n) = (g(n))

f(n) = (g(n))

f(n) = (g(n))

f(n) = (g(n))

n

f(n) = 2n; g(n)

18 = 3

f(n) = O(g(n))

A function f(n) is o(g(n)) if for any positive

constant c, there exists n0 such that

f(n) < c g(n) n n0

or

lim (f(n)/g(n)) = 0

n

19

A function f(n) is (g(n)) if for any positive

constant c, there exists n0 such that

c g(n) < f(n) n n0

or

lim (f(n)/g(n)) =

n

20

Intuitions

Intuitively,

() is like >

() is like

O() is like

() is like =

21

(logN) (logarithmic)

by a constant fraction at each step

(N) (linear)

(N logN)

independently and combining the solution

22

(N2 ) (quadratic)

Typical for algorithms that process all pairs of data items (double nested

loops)

(N3 ) (cubic)

(NK ) (polynomial)

(2N ) (exponential)

23

n

Arithmetic series:

k = 1 + 2 + ... + n =

Geometric series:

k =1

n

n( n + 1)

2

= 1 + x + x 2 + ... + x n =

k =0

x

k =0

n

x n +1 1

(x 1)

x 1

1

1 x

Harmonic series:

k = 1 + 2 + ... + n

lg k = lg(k!)

ln n

k =1

n

n lg n

k =1

n

k

k =1

= 1p + 2 p + ... + n p

1

n p +1

p +1

24

- Manual on Rainfall Analysis For Storm Water Drainage Systems, Second EditionUploaded byShashikant Dattatray Chawathe
- WegenerUploaded byMayuresh Pardeshi
- Numerical Method for engineers-chapter 17Uploaded byMrbudakbaek
- ComplexityUploaded byGeorgescu Gogu
- 90284-res-09Uploaded bylola_rose
- Hunts Zy Man SkiUploaded byHoward Roatti
- Algo Analysis and Time ComplexityUploaded bylavamgmca
- Complexity Analysis 4,5,6Uploaded byGaurav Sharma
- _papaerumajusteUploaded byJefferson Nascimento
- MC Practice, 7.2-7.4Uploaded byJennifer Perkins
- A Guide to Algorithm Design Paradigms Methods and Complexity AnalysisUploaded bydasoundofreason1065
- 22.FullUploaded byLuis Alberto Fuentes
- Amath Olevel Revision Paper 1Uploaded byEmily Tham
- Unit 2 Organizer: Exponents and LogarithmsUploaded byFrankie Rose III
- Tips PhysicsUploaded byAhsan Iftikhar
- index and logUploaded bySabariah Osman
- Lects5to8Uploaded byaiace00
- Revision Lesson 1.pdfUploaded byAaron Farrugia
- 04-ArraysUploaded bygulbar
- archi.pdfUploaded byIbraim Rivera
- 140338.pdfUploaded bysubramanyam62
- On the Hardness of Being Truthful Schapira-harndess-cpppUploaded byDexter Uman
- SYLLABUS IN GEN MATH.docxUploaded byPrincess Racquel Dizon
- TR18-107.pdfUploaded bynviscaq
- Lecture 2Uploaded byFernando Avila
- 9789462390966-c2Uploaded byctadventuresingh
- 38502_Chapter1.pdfUploaded bytechmoorthi
- Document 17Uploaded byMuthumanikandan Hariraman
- live-3651-6501-jairUploaded byMuhammad Majid
- Exponent Unit OutlineUploaded byhix8073

- Basic Concepts and Units in Illumination engineeringUploaded byRajendranbehappy
- Photometry and MeasurementUploaded byRajendranbehappy
- IncandescentUploaded byRajendranbehappy
- FluorescentUploaded byRajendranbehappy
- Grammar and LanguagesUploaded byRajendranbehappy
- 4.5 SportsUploaded byRajendranbehappy
- 4.4 StoresUploaded byRajendranbehappy
- 4.1 IndustrialUploaded byRajendranbehappy
- Predicate CalculusUploaded byRajendranbehappy
- PDA to CFGUploaded byRajendranbehappy
- 4.1 IndustrialUploaded byRajendranbehappy
- 4.3 Office H3Uploaded byRajendranbehappy
- 5.4 Aviation and Transport Lighting H3 NewUploaded byRajendranbehappy
- 5.5 Lighting for Displays and Signaling H3Uploaded byRajendranbehappy
- 4.6 Theaters H3Uploaded byRajendranbehappy
- 4.2 Residential H3 NewUploaded byRajendranbehappy
- PDA to CFG H3Uploaded byRajendranbehappy
- Context Free LanguageUploaded byRajendranbehappy
- 4.2 Residential H3Uploaded byRajendranbehappy
- 5.1 Glare H2Uploaded byRajendranbehappy
- 5.3 streetUploaded byRajendranbehappy
- FunctionUploaded byRajendranbehappy
- 5.1 Glare H1Uploaded byRajendranbehappy
- 2.1 Daylighting H3Uploaded byRajendranbehappy
- LanguageUploaded byRajendranbehappy
- 2.1 Daylighting H2Uploaded byRajendranbehappy
- 2.1 Daylighting H1Uploaded byRajendranbehappy
- Definition of an AlgorithmUploaded byRajendranbehappy
- Regular LanguagesUploaded byRajendranbehappy

- High Rise Garbage Disposal SysUploaded bySivaRaman
- Chaos. Making a New Science James GleickUploaded bymitchxp
- 118-DMR_Quad-Ring-GrooveDesign_01.pdfUploaded byRaja Sekaran Sajja
- (Grcev - 2009) Modeling of Grounding Electrodes Under Lightning CurrentsUploaded byalexanderlima
- carbone exchangers.pdfUploaded byAbderrahim Nadifi
- 1) PlanningUploaded byAkshay Mehta
- COCA COLA PRIZEUploaded byNishant Deva
- Dm 00027543Uploaded byAndy Shang
- gis assignmentUploaded byapi-302579125
- User Manual Achook-1080, G726A,UM0084_LatestUploaded byprajith555
- How Seat Belts Work｜All About Seat Belts｜TAKATA all around you｜TAKATAUploaded byPuneet Bahri
- smbj5.0a-smbj188a_vishay.pdfUploaded byJose Enrique Aguirre Guerrero
- DesignConcernsPropulsionShaftingAlignment.pdfUploaded byAnonymous fj2uXP
- Ferco Arc LrUploaded bySiddarth Madan
- NodeXL Tutorial BenS v2Uploaded byPrakash Joshi
- Evacuation Plans and Simulations for Crowd Egress – A ReviewUploaded byIjaems Journal
- Rover75 - Technical BrochureUploaded byannaliax
- Manual ProMark Field 120 Spectra.pdfUploaded byMarta Sya'bani
- Biesbosch Museum Island _ Studio Marco Vermeulen _ ArchDailyUploaded byAr Mohd Nadeem
- We 0303Uploaded bykorie
- Caudalimetro DanielUploaded byYoSoloYo
- Digital Media and Socety (Athique Adrian ) ContentsUploaded byAnonymous GhyLaqEcUU
- EHS-00030 R6 Equipment Decommissioning and Removal ProcedureUploaded byxjaf01
- comp architectureUploaded byVarun Gupta
- 2017 ZaabaUploaded byjfyj
- Job Description for Hotel Operations ManagerUploaded byImee S. Yu
- Final ReportUploaded byAndre Aguilar
- Business_Process_Analysis_Workbook_9_2013_word.docxUploaded byJohn Patterson
- Easicult Application Brochure - Jet FuelUploaded byviktor_gligorov
- Oil and Gas Roundtable Members 29-5-15Uploaded byQuang Huy Trần