SlideShare ist ein Scribd-Unternehmen logo
1 von 23
 What is the goal of analysis of algorithms?
― To compare algorithms mainly in terms of running time but
also in terms of other factors (e.g., memory requirements,
programmer's effort etc.)
 What do we mean by running time analysis?
― Determine how running time increases as the size of the
problem increases.
An algorithm is a finite set of precise instructions for
performing a computation or for solving a problem.
Worst case
⍟Provides an upper bound on running time
⍟An absolute guarantee that the algorithm would not run longer, no
matter what the inputs are
Best case
⍟Provides a lower bound on running time
⍟Input is the one for which the algorithm runs the fastest
Average case
⍟Provides a prediction about the running time
⍟Assumes that the input is random
• To compare two algorithms with running times f(n) and g(n),
we need a rough measure that characterizes how fast each function grows.
• Express running time as a function of the input size n (i.e., f(n)).
• Compare different functions corresponding to running times.
• Such an analysis is independent of machine time, programming style,etc.
• Compare functions in the limit, that is, asymptotically!
(i.e., for large values of n)
Asymptotic Notation
A way to describe the behavior of functions in
the limit or without bounds.
The notations are defined in terms of functions whose domains
are the set of natural numbers N={0,1,2,...}.
Such notations are convenient for describing the worst-case
running time function T(n).
It can also be extended to the domain of real numbers.
Example : -
x is asymptotic with x + 1
limit - lim
𝑥→∞
𝑓 𝑥 = 𝑘
Roughly translated might read as:
x approaches ∞, f(x) approaches k for
x close to ∞, f(x) is close to k
Two limits often used in analysis are:
lim
𝑥→∞
𝑓 𝑥 = lim
𝑥→∞
𝑓 𝑥 1/x = 0
lim
𝑥→∞
𝑓 𝑥 = lim
𝑥→∞
𝑓 𝑥 cx = ∞ for c>0
Asymptotic Notation
Asymptotic growth rate : -
possibly asymptotically tight upper
bound for f(n) - Cannot do worse, can
do better
n is the problem size.
f(n) ∈ O(g(n)) where:
Meaning for all values of n ≥ 𝑛0f(n) is
on or below g(n).
O(g(n)) is a set of all the functions f(n)
that are less than or equal to cg(n), ∀ n
≥𝑛0.
Big-O Notation (Omicron)
O(g(n)) = { f(n): ∃ positive constants c,
𝑛0such that 0 ≤ f(n) ≤ cg(n), ∀ n ≥𝑛0}
If f(n) ≤ cg(n), c > 0, ∀ n ≥𝑛0then f(n) ∈ O(g(n))
Example of Big O notation
𝐒𝐡𝐨𝐰 𝟐𝐧 𝟐 = 𝐎 𝐧 𝟑 𝟎 ≤ 𝐟 𝐧 ≤ 𝐜𝐠 𝐧 𝐃𝐞𝐟𝐢𝐧𝐚𝐭𝐢𝐨𝐧 𝐨𝐟 𝐎(𝐠 𝐧 )
Solution :-
0 ≤ 2n2
≤ cn3
0/n3≤ 2n2 /n3≤ cn3/n3
Determine C
0 ≤ 2/n ≤ c
0 ≤ 2/1 ≤ c = 2
Substitute
Divide by n3
lim
𝑛→∞
2/𝑛 = 0
2/n maximum when n=1
Satisfied by c=2
1000𝒏 𝟐 + 50n =
O(𝒏 𝟐
)
with c=1050 and 𝐧 𝟎=1
Satisfied by 𝑛0=1
∀ n ≥ 𝑛0=1
If f(n) ≤ cg(n), c > 0, ∀ n ≥ 𝒏 𝟎then f(n) ∈ O(g(n))
Determine 𝒏 𝟎
0 ≤ 2/𝑛0 ≤ 2
0 ≤ 2/2 ≤ 𝑛0
0 ≤ 1 ≤ 𝑛0= 1
0 ≤ 2n2
≤ 2n3
Big Omega Notation (Ω)
possibly asymptotically tight lower bound
for f(n) - Cannot do better, can do worse
f(n) ∈ Ω(g(n)) where:
Meaning for all values of n ≥ 𝑛0f(n) is on or
above g(n).
Ω(g(n)) is a set of all the functions f(n) that are
greater than or equal cg(n), ∀ n ≥𝑛0.
Ω(g(n)) = {f(n): ∃ positive constants c >
0, 𝑛0 such that 0 ≤ cg(n) ≤ f(n), ∀ n ≥𝑛0}
If cg(n) ≤ f(n), c > 0 and ∀ n ≥𝑛0, then f(n) ∈ Ω(g(n))
Example of Ω notation
Solution :-
0 ≤ cg(n) ≤ f(n)
0 ≤ c n2 ≤ 3 n2 + n
0/ n2 ≤ c n2 / n2 ≤ 3 n2 / n2 + n/ n2
0 ≤ c ≤ 3 + 1/n
0 ≤ c ≤ 3
0 ≤ 3 ≤ 3 + 1/ 𝑛0
-3 ≤ 3-3 ≤ 3-3 + 1/ 𝑛0
-3 ≤ 0 ≤ 1/ 𝑛0
𝑛0 =1 satisfies
log 𝑛→∞ 1/𝑛
log 𝑛→∞ 3 + 1 /𝑛 = 3
c = 3
𝐒𝐡𝐨𝐰that 3 𝒏 𝟐
+ n = Ω(𝒏 𝟐
)
3𝒏 𝟐 + n = Ω(𝒏 𝟐 ) with
c=1 and 𝒏 𝟎 =1
Big Theta Notation()
asymptotically tight bound for f(n)
f(n) ∈ (g(n)) where :
Positive means greater than 0.
(g(n)) is a set of all the functions f(n)
that are between 𝑐1 g(n) and 𝑐2g(n),
∀ n ≥ 𝑛0.
If f(n) is between 𝑐1 g(n) and 𝑐2g(n), ∀ n
≥ 𝑛0, then f(n) ∈ (g(n))
(g(n)) =
{f(n): ∃ positive constantsc1,c2, n0such that
0 ≤ c1 g(n) ≤ f(n) ≤ c2g(n), ∀ n ≥ n0}
Example of  notation
Θ: ½n2
- 3n ∈ Θ(n2
) when c1= 1/14, c2= ½ and𝑛0 = 7
Divide by n2
c1n2 ≤ ½n2
- 3n ≤ c2n2
c1≤ ½ - 3/n ≤ c2
O: Determine c2= ½
½ - 3/n ≤ c2
as n → ∞, 3/n → 0
lim
𝑛→∞
1/𝑛 − 3/𝑛 = ½
therefore ½ ≤ c2 o rc2 = ½ maximum for as n → ∞ Ω: Determine c1= 1/14
0 <c1≤ ½ - 3/n
- 3/n > 0 minimum for 𝑛0 = 7
0 <c1= ½ - 3/7 = 7/14 - 6/14 = 1/14
𝑛0: Determine 𝑛0 = 7
c1≤ ½ - 3/ 𝑛0 ≤ c2
1/14 ≤ ½ - 3/𝑛0 ≤ ½
-6/14 ≤ -3/𝑛0 ≤ 0
-𝑛0 ≤ -3*14/6 ≤ 0
𝑛0 ≥ 42/6 ≥ 0
𝑛0 ≥ 7
Solution :-
Show that ½𝒏 𝟐
- 3n ∈ Θ(𝒏 𝟐
) Determine ∃ 𝒄 𝟏, 𝒄 𝟐, 𝒏 𝟎positive constants such that:
Relations Between , W, O
Theorem : For any two functions g(n) and f(n),
f(n) = (g(n)) iff
f(n) = O(g(n)) and f(n) = W(g(n)).
 I.e., (g(n)) = O(g(n))  WW(g(n))
 In practice, asymptotically tight bounds are obtained from asymptotic
upper and lower bounds.
Little-o Notation (omicron)
non-asymptotically tight upper bound for f(n)
f(n) ∈ o(g(n)) where :
lim
𝑛→∞
f(n) / g(n) = 0
for any 0 < c < ∞
o(g(n)) = {f(n): for any constant c >
0, ∃ a constant n0 >0, such that: 0
≤ f(n) <cg(n), ∀ n ≥n0}
o(g(n)) = {f(n): for any constant c > 0, ∃ a constant
n0 >0,
such that: 0 ≤ f(n) <cg(n), ∀ n ≥n0}
o(f(n))
f(n)
n0
Little-ω Notation (omega)
non-asymptotically tight lower bound for f(n)
f(n) ∈ ω(g(n)) where :
for any 0 < c ≤ ∞
lim
𝑛→∞
f(n) / g(n) = c
for some 0 < c ≤ ∞
Ω possibly asymptotically tight lower bound
ω non-asymptotically tight lower bound
ω(g(n)) = {f(n): for any constant c > 0, ∃ a constant n0 >0,
such that 0 ≤ cg(n) <f(n), ∀ n ≥n0}
Ω(g(n)) = {f(n): for some constant c > 0, ∃ a
constant n0 >0, such that 0 ≤ cg(n) ≤ f(n),
∀ n ≥n0}
lim
𝑛→∞
f(n) / g(n) = ∞
(f(n))
f(n)
n0
Comparison of Functions
 An imprecise analogy between the asymptotic comparison of
two function f and g and the relation between their values:
f(n) = O(g(n)) ≈ f(n) ≤ g(n)
f(n) = Ω(g(n)) ≈ f(n) ≥ g(n)
f(n) = Θ(g(n)) ≈ f(n) = g(n)
f(n) = o(g(n)) ≈ f(n) < g(n)
f(n) = ω(g(n)) ≈ f(n) > g(n)
lim [f(n) / g(n)] = 0  f(n)  o(g(n))
n
lim [f(n) / g(n)] <   f(n)  O(g(n))
n
0 < lim [f(n) / g(n)] <   f(n)  (g(n))
n
0 < lim [f(n) / g(n)]  f(n) W(g(n))
n
Lim [f(n) / g(n)] =   f(n)  (g(n))
n
lim [f(n) / g(n)] undefined can’t say
n
Limits
Properties
 Transitivity
f(n) = (g(n)) & g(n) = (h(n))  f(n) = (h(n))
f(n) = O(g(n)) & g(n) = O(h(n))  f(n) = O(h(n))
f(n) = W(g(n)) & g(n) = W(h(n))  f(n) = W(h(n))
f(n) = o (g(n)) & g(n) = o (h(n))  f(n) = o (h(n))
f(n) = (g(n)) & g(n) = (h(n))  f(n) = (h(n))
 Reflexivity
f(n) = (f(n))
f(n) = O(f(n))
f(n) = W(f(n))
 Symmetry
f(n) = (g(n)) iff g(n) = (f(n))
 Complementarity
f(n) = O(g(n)) iff g(n) = W(f(n))
f(n) = o(g(n)) iff g(n) = ((f(n))
Asymptotic notation in
equations and inequalities
 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)
 On the left-hand side :-
2n2 + (n) = (n2) means :
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.
Class Name Comment
1 constant – Instructions are executed once or a few times
log n logarithmic – A big problem is solved by cutting the original problem in smaller
sizes, by a constant fraction at each step
n linear – A small amount of processing is done on each input element
n log n linearithmic – A problem is solved by dividing it into smaller problems, solving
them independently and combining the solution
𝒏 𝟐 quadratic – Typical for algorithms that process all pairs of data items (double
nested loops)
𝒏 𝟑 cubic – Processing of triples of data (triple nested loops)
𝟐 𝒏 exponential – Few exponential algorithms are appropriate for practical use
n! factorial – Typical for algorithms that generate all permutations of an n-element
set.
Acknowledgement
Firstly , I would like to thanks Mr. Abhishek
Mukhopadhyay for giving us such an interesting
topic to work with and Of course last but not the
least I express my esteemed gratitude to my group
members Meraj,Papiya,Nazaan,Protap who put up
with me during the whole period and provided me
valuable guidance in times of need and gave
wonderful cooperation and support to complete
the project.
Asymptotic Notation

Weitere ähnliche Inhalte

Was ist angesagt?

Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm AnalysisMary Margarat
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
Lecture 14 run time environment
Lecture 14 run time environmentLecture 14 run time environment
Lecture 14 run time environmentIffat Anjum
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IMohamed Loey
 
Divide and conquer - Quick sort
Divide and conquer - Quick sortDivide and conquer - Quick sort
Divide and conquer - Quick sortMadhu Bala
 
how to calclute time complexity of algortihm
how to calclute time complexity of algortihmhow to calclute time complexity of algortihm
how to calclute time complexity of algortihmSajid Marwat
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back trackingTech_MX
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of AlgorithmsSwapnil Agrawal
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursionAbdullah Al-hazmy
 
Performance analysis and randamized agoritham
Performance analysis and randamized agorithamPerformance analysis and randamized agoritham
Performance analysis and randamized agorithamlilyMalar1
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting AlgorithmsPranay Neema
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
LR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingLR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingR Islam
 

Was ist angesagt? (20)

Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
asymptotic notation
asymptotic notationasymptotic notation
asymptotic notation
 
Parsing
ParsingParsing
Parsing
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Lecture 14 run time environment
Lecture 14 run time environmentLecture 14 run time environment
Lecture 14 run time environment
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
 
Divide and conquer - Quick sort
Divide and conquer - Quick sortDivide and conquer - Quick sort
Divide and conquer - Quick sort
 
Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
 
how to calclute time complexity of algortihm
how to calclute time complexity of algortihmhow to calclute time complexity of algortihm
how to calclute time complexity of algortihm
 
Complexity analysis in Algorithms
Complexity analysis in AlgorithmsComplexity analysis in Algorithms
Complexity analysis in Algorithms
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
 
Performance analysis and randamized agoritham
Performance analysis and randamized agorithamPerformance analysis and randamized agoritham
Performance analysis and randamized agoritham
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
LR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingLR(1) and SLR(1) parsing
LR(1) and SLR(1) parsing
 

Andere mochten auch

Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAmrinder Arora
 
Lecture 4 asymptotic notations
Lecture 4   asymptotic notationsLecture 4   asymptotic notations
Lecture 4 asymptotic notationsjayavignesh86
 
asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations iAli mahmood
 
Lecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithmsLecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithmsVivek Bhargav
 
CS Fundamentals: Scalability and Memory
CS Fundamentals: Scalability and MemoryCS Fundamentals: Scalability and Memory
CS Fundamentals: Scalability and MemoryHaseeb Qureshi
 
asymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysisasymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysisAnindita Kundu
 
Lec2 Algorth
Lec2 AlgorthLec2 Algorth
Lec2 Algorthhumanist3
 
Asymptotic Growth of Functions
Asymptotic Growth of FunctionsAsymptotic Growth of Functions
Asymptotic Growth of FunctionsDEVTYPE
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexityAnkit Katiyar
 
Comment optimiser sa visibilité sur Google
Comment optimiser sa visibilité sur GoogleComment optimiser sa visibilité sur Google
Comment optimiser sa visibilité sur GoogleMarie-Joseph HARPON
 

Andere mochten auch (20)

Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data Structures
 
02 asymp
02 asymp02 asymp
02 asymp
 
Lecture1
Lecture1Lecture1
Lecture1
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Lecture 4 asymptotic notations
Lecture 4   asymptotic notationsLecture 4   asymptotic notations
Lecture 4 asymptotic notations
 
big_oh
big_ohbig_oh
big_oh
 
asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations i
 
Lecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithmsLecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithms
 
CS Fundamentals: Scalability and Memory
CS Fundamentals: Scalability and MemoryCS Fundamentals: Scalability and Memory
CS Fundamentals: Scalability and Memory
 
asymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysisasymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysis
 
Lec2 Algorth
Lec2 AlgorthLec2 Algorth
Lec2 Algorth
 
Asymptotic Growth of Functions
Asymptotic Growth of FunctionsAsymptotic Growth of Functions
Asymptotic Growth of Functions
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Comment optimiser sa visibilité sur Google
Comment optimiser sa visibilité sur GoogleComment optimiser sa visibilité sur Google
Comment optimiser sa visibilité sur Google
 
Presença virtual
Presença virtualPresença virtual
Presença virtual
 
Innovaciones para vivir bien en casa cuando las personas tienen una situación...
Innovaciones para vivir bien en casa cuando las personas tienen una situación...Innovaciones para vivir bien en casa cuando las personas tienen una situación...
Innovaciones para vivir bien en casa cuando las personas tienen una situación...
 
DOCENTE
DOCENTEDOCENTE
DOCENTE
 
Dia del libro 2016
Dia del libro 2016Dia del libro 2016
Dia del libro 2016
 
Internacionales
InternacionalesInternacionales
Internacionales
 

Ähnlich wie Asymptotic Notation

Design and analysis of algorithm ppt ppt
Design and analysis of algorithm ppt pptDesign and analysis of algorithm ppt ppt
Design and analysis of algorithm ppt pptsrushtiivp
 
Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfShaistaRiaz4
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and ComplexityRajandeep Gill
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notationsajinis3
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Deepak John
 
lecture 1
lecture 1lecture 1
lecture 1sajinsc
 
Clase3 Notacion
Clase3 NotacionClase3 Notacion
Clase3 Notacionluzenith_g
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptISHANAMRITSRIVASTAVA
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfAmayJaiswal4
 
Lecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).pptLecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).pptZohairMughal1
 
Lecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptLecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptZohairMughal1
 
2-AnalysisOfAlgs.ppt
2-AnalysisOfAlgs.ppt2-AnalysisOfAlgs.ppt
2-AnalysisOfAlgs.pptTahseenEjaz3
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptxKarthikVijay59
 
Dr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabistDr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabistGatewayggg Testeru
 

Ähnlich wie Asymptotic Notation (20)

Design and analysis of algorithm ppt ppt
Design and analysis of algorithm ppt pptDesign and analysis of algorithm ppt ppt
Design and analysis of algorithm ppt ppt
 
Lecture3(b).pdf
Lecture3(b).pdfLecture3(b).pdf
Lecture3(b).pdf
 
Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdf
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and Complexity
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
 
DAA_LECT_2.pdf
DAA_LECT_2.pdfDAA_LECT_2.pdf
DAA_LECT_2.pdf
 
lecture 1
lecture 1lecture 1
lecture 1
 
Clase3 Notacion
Clase3 NotacionClase3 Notacion
Clase3 Notacion
 
Asymtotic Appoach.ppt
Asymtotic Appoach.pptAsymtotic Appoach.ppt
Asymtotic Appoach.ppt
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.ppt
 
02-asymp.ppt
02-asymp.ppt02-asymp.ppt
02-asymp.ppt
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdf
 
Lecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).pptLecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).ppt
 
Lecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptLecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.ppt
 
2-AnalysisOfAlgs.ppt
2-AnalysisOfAlgs.ppt2-AnalysisOfAlgs.ppt
2-AnalysisOfAlgs.ppt
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptx
 
Dr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabistDr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabist
 

Kürzlich hochgeladen

The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 

Kürzlich hochgeladen (20)

The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 

Asymptotic Notation

  • 1.
  • 2.  What is the goal of analysis of algorithms? ― To compare algorithms mainly in terms of running time but also in terms of other factors (e.g., memory requirements, programmer's effort etc.)  What do we mean by running time analysis? ― Determine how running time increases as the size of the problem increases. An algorithm is a finite set of precise instructions for performing a computation or for solving a problem.
  • 3. Worst case ⍟Provides an upper bound on running time ⍟An absolute guarantee that the algorithm would not run longer, no matter what the inputs are Best case ⍟Provides a lower bound on running time ⍟Input is the one for which the algorithm runs the fastest Average case ⍟Provides a prediction about the running time ⍟Assumes that the input is random
  • 4. • To compare two algorithms with running times f(n) and g(n), we need a rough measure that characterizes how fast each function grows. • Express running time as a function of the input size n (i.e., f(n)). • Compare different functions corresponding to running times. • Such an analysis is independent of machine time, programming style,etc. • Compare functions in the limit, that is, asymptotically! (i.e., for large values of n)
  • 5. Asymptotic Notation A way to describe the behavior of functions in the limit or without bounds. The notations are defined in terms of functions whose domains are the set of natural numbers N={0,1,2,...}. Such notations are convenient for describing the worst-case running time function T(n). It can also be extended to the domain of real numbers.
  • 6. Example : - x is asymptotic with x + 1 limit - lim 𝑥→∞ 𝑓 𝑥 = 𝑘 Roughly translated might read as: x approaches ∞, f(x) approaches k for x close to ∞, f(x) is close to k Two limits often used in analysis are: lim 𝑥→∞ 𝑓 𝑥 = lim 𝑥→∞ 𝑓 𝑥 1/x = 0 lim 𝑥→∞ 𝑓 𝑥 = lim 𝑥→∞ 𝑓 𝑥 cx = ∞ for c>0 Asymptotic Notation
  • 8. possibly asymptotically tight upper bound for f(n) - Cannot do worse, can do better n is the problem size. f(n) ∈ O(g(n)) where: Meaning for all values of n ≥ 𝑛0f(n) is on or below g(n). O(g(n)) is a set of all the functions f(n) that are less than or equal to cg(n), ∀ n ≥𝑛0. Big-O Notation (Omicron) O(g(n)) = { f(n): ∃ positive constants c, 𝑛0such that 0 ≤ f(n) ≤ cg(n), ∀ n ≥𝑛0} If f(n) ≤ cg(n), c > 0, ∀ n ≥𝑛0then f(n) ∈ O(g(n))
  • 9. Example of Big O notation 𝐒𝐡𝐨𝐰 𝟐𝐧 𝟐 = 𝐎 𝐧 𝟑 𝟎 ≤ 𝐟 𝐧 ≤ 𝐜𝐠 𝐧 𝐃𝐞𝐟𝐢𝐧𝐚𝐭𝐢𝐨𝐧 𝐨𝐟 𝐎(𝐠 𝐧 ) Solution :- 0 ≤ 2n2 ≤ cn3 0/n3≤ 2n2 /n3≤ cn3/n3 Determine C 0 ≤ 2/n ≤ c 0 ≤ 2/1 ≤ c = 2 Substitute Divide by n3 lim 𝑛→∞ 2/𝑛 = 0 2/n maximum when n=1 Satisfied by c=2 1000𝒏 𝟐 + 50n = O(𝒏 𝟐 ) with c=1050 and 𝐧 𝟎=1 Satisfied by 𝑛0=1 ∀ n ≥ 𝑛0=1 If f(n) ≤ cg(n), c > 0, ∀ n ≥ 𝒏 𝟎then f(n) ∈ O(g(n)) Determine 𝒏 𝟎 0 ≤ 2/𝑛0 ≤ 2 0 ≤ 2/2 ≤ 𝑛0 0 ≤ 1 ≤ 𝑛0= 1 0 ≤ 2n2 ≤ 2n3
  • 10. Big Omega Notation (Ω) possibly asymptotically tight lower bound for f(n) - Cannot do better, can do worse f(n) ∈ Ω(g(n)) where: Meaning for all values of n ≥ 𝑛0f(n) is on or above g(n). Ω(g(n)) is a set of all the functions f(n) that are greater than or equal cg(n), ∀ n ≥𝑛0. Ω(g(n)) = {f(n): ∃ positive constants c > 0, 𝑛0 such that 0 ≤ cg(n) ≤ f(n), ∀ n ≥𝑛0} If cg(n) ≤ f(n), c > 0 and ∀ n ≥𝑛0, then f(n) ∈ Ω(g(n))
  • 11. Example of Ω notation Solution :- 0 ≤ cg(n) ≤ f(n) 0 ≤ c n2 ≤ 3 n2 + n 0/ n2 ≤ c n2 / n2 ≤ 3 n2 / n2 + n/ n2 0 ≤ c ≤ 3 + 1/n 0 ≤ c ≤ 3 0 ≤ 3 ≤ 3 + 1/ 𝑛0 -3 ≤ 3-3 ≤ 3-3 + 1/ 𝑛0 -3 ≤ 0 ≤ 1/ 𝑛0 𝑛0 =1 satisfies log 𝑛→∞ 1/𝑛 log 𝑛→∞ 3 + 1 /𝑛 = 3 c = 3 𝐒𝐡𝐨𝐰that 3 𝒏 𝟐 + n = Ω(𝒏 𝟐 ) 3𝒏 𝟐 + n = Ω(𝒏 𝟐 ) with c=1 and 𝒏 𝟎 =1
  • 12. Big Theta Notation() asymptotically tight bound for f(n) f(n) ∈ (g(n)) where : Positive means greater than 0. (g(n)) is a set of all the functions f(n) that are between 𝑐1 g(n) and 𝑐2g(n), ∀ n ≥ 𝑛0. If f(n) is between 𝑐1 g(n) and 𝑐2g(n), ∀ n ≥ 𝑛0, then f(n) ∈ (g(n)) (g(n)) = {f(n): ∃ positive constantsc1,c2, n0such that 0 ≤ c1 g(n) ≤ f(n) ≤ c2g(n), ∀ n ≥ n0}
  • 13. Example of  notation Θ: ½n2 - 3n ∈ Θ(n2 ) when c1= 1/14, c2= ½ and𝑛0 = 7 Divide by n2 c1n2 ≤ ½n2 - 3n ≤ c2n2 c1≤ ½ - 3/n ≤ c2 O: Determine c2= ½ ½ - 3/n ≤ c2 as n → ∞, 3/n → 0 lim 𝑛→∞ 1/𝑛 − 3/𝑛 = ½ therefore ½ ≤ c2 o rc2 = ½ maximum for as n → ∞ Ω: Determine c1= 1/14 0 <c1≤ ½ - 3/n - 3/n > 0 minimum for 𝑛0 = 7 0 <c1= ½ - 3/7 = 7/14 - 6/14 = 1/14 𝑛0: Determine 𝑛0 = 7 c1≤ ½ - 3/ 𝑛0 ≤ c2 1/14 ≤ ½ - 3/𝑛0 ≤ ½ -6/14 ≤ -3/𝑛0 ≤ 0 -𝑛0 ≤ -3*14/6 ≤ 0 𝑛0 ≥ 42/6 ≥ 0 𝑛0 ≥ 7 Solution :- Show that ½𝒏 𝟐 - 3n ∈ Θ(𝒏 𝟐 ) Determine ∃ 𝒄 𝟏, 𝒄 𝟐, 𝒏 𝟎positive constants such that:
  • 14. Relations Between , W, O Theorem : For any two functions g(n) and f(n), f(n) = (g(n)) iff f(n) = O(g(n)) and f(n) = W(g(n)).  I.e., (g(n)) = O(g(n))  WW(g(n))  In practice, asymptotically tight bounds are obtained from asymptotic upper and lower bounds.
  • 15. Little-o Notation (omicron) non-asymptotically tight upper bound for f(n) f(n) ∈ o(g(n)) where : lim 𝑛→∞ f(n) / g(n) = 0 for any 0 < c < ∞ o(g(n)) = {f(n): for any constant c > 0, ∃ a constant n0 >0, such that: 0 ≤ f(n) <cg(n), ∀ n ≥n0} o(g(n)) = {f(n): for any constant c > 0, ∃ a constant n0 >0, such that: 0 ≤ f(n) <cg(n), ∀ n ≥n0} o(f(n)) f(n) n0
  • 16. Little-ω Notation (omega) non-asymptotically tight lower bound for f(n) f(n) ∈ ω(g(n)) where : for any 0 < c ≤ ∞ lim 𝑛→∞ f(n) / g(n) = c for some 0 < c ≤ ∞ Ω possibly asymptotically tight lower bound ω non-asymptotically tight lower bound ω(g(n)) = {f(n): for any constant c > 0, ∃ a constant n0 >0, such that 0 ≤ cg(n) <f(n), ∀ n ≥n0} Ω(g(n)) = {f(n): for some constant c > 0, ∃ a constant n0 >0, such that 0 ≤ cg(n) ≤ f(n), ∀ n ≥n0} lim 𝑛→∞ f(n) / g(n) = ∞ (f(n)) f(n) n0
  • 17. Comparison of Functions  An imprecise analogy between the asymptotic comparison of two function f and g and the relation between their values: f(n) = O(g(n)) ≈ f(n) ≤ g(n) f(n) = Ω(g(n)) ≈ f(n) ≥ g(n) f(n) = Θ(g(n)) ≈ f(n) = g(n) f(n) = o(g(n)) ≈ f(n) < g(n) f(n) = ω(g(n)) ≈ f(n) > g(n)
  • 18. lim [f(n) / g(n)] = 0  f(n)  o(g(n)) n lim [f(n) / g(n)] <   f(n)  O(g(n)) n 0 < lim [f(n) / g(n)] <   f(n)  (g(n)) n 0 < lim [f(n) / g(n)]  f(n) W(g(n)) n Lim [f(n) / g(n)] =   f(n)  (g(n)) n lim [f(n) / g(n)] undefined can’t say n Limits
  • 19. Properties  Transitivity f(n) = (g(n)) & g(n) = (h(n))  f(n) = (h(n)) f(n) = O(g(n)) & g(n) = O(h(n))  f(n) = O(h(n)) f(n) = W(g(n)) & g(n) = W(h(n))  f(n) = W(h(n)) f(n) = o (g(n)) & g(n) = o (h(n))  f(n) = o (h(n)) f(n) = (g(n)) & g(n) = (h(n))  f(n) = (h(n))  Reflexivity f(n) = (f(n)) f(n) = O(f(n)) f(n) = W(f(n))  Symmetry f(n) = (g(n)) iff g(n) = (f(n))  Complementarity f(n) = O(g(n)) iff g(n) = W(f(n)) f(n) = o(g(n)) iff g(n) = ((f(n))
  • 20. Asymptotic notation in equations and inequalities  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)  On the left-hand side :- 2n2 + (n) = (n2) means : 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.
  • 21. Class Name Comment 1 constant – Instructions are executed once or a few times log n logarithmic – A big problem is solved by cutting the original problem in smaller sizes, by a constant fraction at each step n linear – A small amount of processing is done on each input element n log n linearithmic – A problem is solved by dividing it into smaller problems, solving them independently and combining the solution 𝒏 𝟐 quadratic – Typical for algorithms that process all pairs of data items (double nested loops) 𝒏 𝟑 cubic – Processing of triples of data (triple nested loops) 𝟐 𝒏 exponential – Few exponential algorithms are appropriate for practical use n! factorial – Typical for algorithms that generate all permutations of an n-element set.
  • 22. Acknowledgement Firstly , I would like to thanks Mr. Abhishek Mukhopadhyay for giving us such an interesting topic to work with and Of course last but not the least I express my esteemed gratitude to my group members Meraj,Papiya,Nazaan,Protap who put up with me during the whole period and provided me valuable guidance in times of need and gave wonderful cooperation and support to complete the project.