Top Banner
Conditional Asymptotic Notations V. Balasubramanian
36

Conditional Asymptotic Notations

Apr 14, 2015

Download

Documents

kalai2790

design and analysis of algorithm M.E syllabus.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Conditional Asymptotic Notations

Conditional Asymptotic Notations

V. Balasubramanian

Page 2: Conditional Asymptotic Notations

Asymptotic Notations

• Asymptotic notation deals with the behaviour of a function in the limit, that is, for sufficiently large values of its parameter. Often, when analysing the run time of an algorithm, it is easier to obtain an approximate formula for the run-time which gives a good indication of the algorithm performance for large problem instances.

Page 3: Conditional Asymptotic Notations

Contd…• For example, suppose the exact run-time T(n) of

an algorithm on an input of size n is• T(n) = 5n2 + 6n + 25 seconds. Then, since n is ≥0, we have

• 5n2 ≤ T(n) ≤ 6n2 for all n≥9. • Thus we can say that T(n) is roughly

proportional to• n2 for sufficiently large values of n. • We write this as• T(n)ϵ Θ(n2 ), or say that• “T(n) is in the exact order of n2”.

Page 4: Conditional Asymptotic Notations

Contd…

• The main feature of this approach is that we can ignore constant factors and concentrate on the terms in the expression for T(n) that will dominate the function’s behaviour as n becomes large.

Page 5: Conditional Asymptotic Notations

Contd…• Generally, an algorithm with a run-time of Θ(n

log n) will perform better than an algorithm with a run-time of order Θ(n2 ), provided that n is sufficiently large. However, for small values of n the Θ(n2 ) algorithm may run faster due to having smaller constant factors. The value of n at which the Θ(n log n) algorithm first outperforms the Θ(n2 ) algorithm is called the break-even point for theΘ(n log n) algorithm.

Page 6: Conditional Asymptotic Notations

Contd…Big Oh notation

Page 7: Conditional Asymptotic Notations

Big-oh

Page 8: Conditional Asymptotic Notations

Contd…

Page 9: Conditional Asymptotic Notations

Omega lower Bound Law of duality

Page 10: Conditional Asymptotic Notations

Theta Notation

Page 11: Conditional Asymptotic Notations

Maximum Rule

Page 12: Conditional Asymptotic Notations

Contd…

Page 13: Conditional Asymptotic Notations

Contd…

Page 14: Conditional Asymptotic Notations

Contd…

Page 15: Conditional Asymptotic Notations

L’ Hospital Rule

Page 16: Conditional Asymptotic Notations

P, NP

Page 17: Conditional Asymptotic Notations

Conditional asymptotic notation

• Many algorithms easier to analyse if initially we restrict our attention to instances whose size satisfies a certain condition, such as a power of 2.

Page 18: Conditional Asymptotic Notations

Contd…

Page 19: Conditional Asymptotic Notations

Contd…

Page 20: Conditional Asymptotic Notations

Contd…

Page 21: Conditional Asymptotic Notations

Contd…

Page 22: Conditional Asymptotic Notations

Example

Page 23: Conditional Asymptotic Notations

Contd…

Page 24: Conditional Asymptotic Notations

Smooth functions

Page 25: Conditional Asymptotic Notations

Non-smooth functions

Page 26: Conditional Asymptotic Notations

Smoothness rule

Page 27: Conditional Asymptotic Notations

Multiplication

Page 28: Conditional Asymptotic Notations

Another technique

Page 29: Conditional Asymptotic Notations

Contd…

Page 30: Conditional Asymptotic Notations

Contd…

Page 31: Conditional Asymptotic Notations

Contd…

Page 32: Conditional Asymptotic Notations

Example

Page 33: Conditional Asymptotic Notations

Example

Page 34: Conditional Asymptotic Notations

Example

Page 35: Conditional Asymptotic Notations

Example

Page 36: Conditional Asymptotic Notations

Master Theorem