Sunteți pe pagina 1din 36

Conditional Asymptotic Notations

V. Balasubramanian

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.

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 n9. 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.

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 functions behaviour as n becomes large.

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.

ContdBig Oh notation

Big-oh

Contd

Omega lower Bound Law of duality

Theta Notation

Maximum Rule

Contd

Contd

Contd

L Hospital Rule

P, NP

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.

Contd

Contd

Contd

Contd

Example

Contd

Smooth functions

Non-smooth functions

Smoothness rule

Multiplication

Another technique

Contd

Contd

Contd

Example

Example

Example

Example

Master Theorem

S-ar putea să vă placă și