SlideShare a Scribd company logo
Course Name: Design and Analysis of Algorithm
Topic: Asymptotic Notation- Analysis of Algorithms
Course code : CS 3102
Credits : 4
Mode of delivery : Hybrid (Power point presentation)
Faculty : Dr. Ajit Noonia
Email-id : ajit.noonia@jaipur.manipal.edu
B.TECH V SEM CSE
ACADEMIC YEAR: 2024-2025
1
Asymptotic Notation- Analysis of Algorithms
CS3102 (DAA) 2
Asymptotic Notation
• By now you should have an intuitive feel for asymptotic (big-O)
notation:
• What does O(n) running time mean?
• O(n2)?
• O(n lg n)?
• Our first task is to define this notation more formally and
completely
CS3102 (DAA)
3
Asymptotic Notation
Asymptotic notations describe algorithm running time as the
input approaches a specific value.
For instance, in bubble sort, when the input is already sorted,
the algorithm's running time is linear (best case). However,
when the input is in reverse order, the algorithm takes
maximum time (quadratic) to sort the elements (worst case).
The notations used include Theta, Omega, and Big-O.
CS3102 (DAA)
4
Big-O Notation (O-notation)
CS3102 (DAA)
5
Definition: Let g and f be functions from the set of natural
numbers to itself. The function f is said to be O(g) (read
big-oh of g), if there is a constant c > 0 and a natural
number n0 such that f(n) ≤ cg(n) for all n ≥ n0 .
O- big-oh notation
1<log n < √n < n < n*log n < n2 < n3 < - - - - - - -< 2n < 3n < ----<nn
The Big-O Asymptotic Notation gives us the Upper Bound Idea,
mathematically described below:
f(n) = O(g(n)) if there exists a positive integer n0 and a positive constant c,
such that f(n) ≤ cg(n) ∀ n≥n0
Example
f(n) = 2n + 3
CS3102 (DAA)
7
Big-O Notation (O-notation)
The Gist of Big-Oh
Take functions f(n) & g(n), consider only the most
significant term, and remove constant multipliers:
▪ 5n+3 → n
▪ 7n+.5n2+2000 → n2
▪ 300n+12+nlogn → n log n
Then compare the functions; if f(n) ≤ g(n), then f(n) is
in O(g(n))
CS3102 (DAA) 8
More Examples
9
• Show that 30n+8 is O(n).
– Show c,n0
: 30n+8  cn, n>n0 .
• Let c=31, n0=8.Assume n>n0=8.Then
cn = 31n = 30n + n > 30n+8, so 30n+8 < cn.
n>n0=8 →
Increasing n →
Big-O example, graphically
Value
of
function
→
n
30n+8
cn =
31n
10
30n+8
O(n)
There is no unique set of values for n0 and c in proving the
asymptotic bounds.
Prove that 100n + 5 = O(n2)
– 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 n0that satisfy the asymptotic notation relation
No Uniqueness
•
•
Big Oh: Common Categories
From fastest to slowest
O(1) constant (or O(k) for constant k)
O(log n) logarithmic
O(n) linear
O(n log n) "n log n”
O(n2) quadratic
O(n3) cubic
O(nk) polynomial (where is k is constant)
O(kn) exponential (where constant k > 1)
CS3102 (DAA) 12
Omega Notation (Ω-notation)
CS3102 (DAA)
13
Definition: Let g and f be functions from the set of natural
numbers to itself. The function f is said to be Ω(g) (read
Omega Notation of g), if there is a constant c > 0 and a
natural number n0 such that f(n) ≥ cg(n) for all n ≥ n0.
O- big-oh notation
1<log n < √n < n < n*log n < n2 < n3 < - - - - - - -< 2n < 3n < ----<nn
The Omega Notation (Ω-notation) Notation gives us the Lower Bound
Idea, mathematically described below:
f(n) = Ω(g(n)) if there exists a positive integer n0 and a positive constant c,
such that f(n) ≥ cg(n) ∀ n ≥ n0
Example
f(n) = 2n + 3
f(n) = 5n2 + 10
Omega Notation (Ω-notation)
CS3102 (DAA)
15
Theta Notation (Θ-notation)
Definition: Let g and f be functions from the set of natural numbers to itself. The
function f is said to be Θ(g) (Theta Notation of g) if there exists constant c1 and
c2 > 0 and a natural number n0 such that c1g(n) ≤ f(n) ≤ c2g(n) for all n ≥ n0.
CS3102 (DAA)
16
Theta Notation (Θ-notation)
1<log n < √n < n < n*log n < n2 < n3 < - - - - - - -< 2n < 3n < ----<nn
The Theta Notation (Θ-notation) gives us the Tight Bound Idea,
mathematically described below:
f(n) = Θ(g(n)) if there exists a positive integer n0 and a positive constant c1
and c2, such that c1g(n) ≤ f(n) ≤ c2g(n) ∀ n ≥ n0
Example
f(n) = 2n + 3
f(n) = 5n2 + 10
Asymptotic Notation
CS3102 (DAA)
18
CS3102 (DAA)
19
Example
f(n) = 2 n2 + 3n + 4
f(n) = n2 log(n) + n
f(n) = n!

More Related Content

PPTX
Analysis of algorithms
PPTX
Binary search design and ana algorithm.pptx
PPTX
Asymptotic notation
PDF
Lecture 3(a) Asymptotic-analysis.pdf
PPTX
DAA Week 2 slide for design algorithm and analysis.pptx
PPTX
Algorithm big o
PPTX
Analysis of algorithn class 3
Analysis of algorithms
Binary search design and ana algorithm.pptx
Asymptotic notation
Lecture 3(a) Asymptotic-analysis.pdf
DAA Week 2 slide for design algorithm and analysis.pptx
Algorithm big o
Analysis of algorithn class 3

Similar to 2. Asymptotic Notation- Analysis of Algorithms.pdf (20)

PDF
Asymptotic notation
PPTX
Asymptotic notation
PPTX
2_Asymptotic notations.pptx
PPTX
Asymptotic notation ada
PDF
Asymptotic Analysis of algorithm in competitive Programming
PDF
asymptoticnotations-111102093214-phpapp01 (1).pdf
PPTX
Dr hasany 2467_16649_1_lec-2-zabist
PPT
Analysis of algo
PPT
Asymptotic analysis
PDF
PPT
Asymptotic notations
PDF
Time complexity (linear search vs binary search)
PDF
6_12_13Asymptotic analysiskfnhlkjsbfbkjs.pdf
PDF
Data Structures and Algorithms - Lec 02.pdf
PDF
1ST_UNIT_DAdefewfrewfgrwefrAdfdgfdsgevedr (2).pdf
PPT
Asymptoptic notations
PPTX
algorith oresentation with infographics.pptx
PDF
The bog oh notation
PPTX
Asymptotic_Notations_v2_1709293258280.pptx
PPT
AsymptoticAnalysis-goal of analysis of algorithms
Asymptotic notation
Asymptotic notation
2_Asymptotic notations.pptx
Asymptotic notation ada
Asymptotic Analysis of algorithm in competitive Programming
asymptoticnotations-111102093214-phpapp01 (1).pdf
Dr hasany 2467_16649_1_lec-2-zabist
Analysis of algo
Asymptotic analysis
Asymptotic notations
Time complexity (linear search vs binary search)
6_12_13Asymptotic analysiskfnhlkjsbfbkjs.pdf
Data Structures and Algorithms - Lec 02.pdf
1ST_UNIT_DAdefewfrewfgrwefrAdfdgfdsgevedr (2).pdf
Asymptoptic notations
algorith oresentation with infographics.pptx
The bog oh notation
Asymptotic_Notations_v2_1709293258280.pptx
AsymptoticAnalysis-goal of analysis of algorithms
Ad

Recently uploaded (20)

PPTX
1_Introduction to advance data techniques.pptx
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
Computer network topology notes for revision
PDF
Launch Your Data Science Career in Kochi – 2025
PPTX
Business Acumen Training GuidePresentation.pptx
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
Introduction to Knowledge Engineering Part 1
PPT
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
PPTX
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
Supervised vs unsupervised machine learning algorithms
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPTX
Database Infoormation System (DBIS).pptx
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PPT
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
1_Introduction to advance data techniques.pptx
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
Computer network topology notes for revision
Launch Your Data Science Career in Kochi – 2025
Business Acumen Training GuidePresentation.pptx
Data_Analytics_and_PowerBI_Presentation.pptx
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
Introduction to Knowledge Engineering Part 1
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
Supervised vs unsupervised machine learning algorithms
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Database Infoormation System (DBIS).pptx
.pdf is not working space design for the following data for the following dat...
oil_refinery_comprehensive_20250804084928 (1).pptx
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
Ad

2. Asymptotic Notation- Analysis of Algorithms.pdf

  • 1. Course Name: Design and Analysis of Algorithm Topic: Asymptotic Notation- Analysis of Algorithms Course code : CS 3102 Credits : 4 Mode of delivery : Hybrid (Power point presentation) Faculty : Dr. Ajit Noonia Email-id : ajit.noonia@jaipur.manipal.edu B.TECH V SEM CSE ACADEMIC YEAR: 2024-2025 1
  • 2. Asymptotic Notation- Analysis of Algorithms CS3102 (DAA) 2
  • 3. Asymptotic Notation • By now you should have an intuitive feel for asymptotic (big-O) notation: • What does O(n) running time mean? • O(n2)? • O(n lg n)? • Our first task is to define this notation more formally and completely CS3102 (DAA) 3
  • 4. Asymptotic Notation Asymptotic notations describe algorithm running time as the input approaches a specific value. For instance, in bubble sort, when the input is already sorted, the algorithm's running time is linear (best case). However, when the input is in reverse order, the algorithm takes maximum time (quadratic) to sort the elements (worst case). The notations used include Theta, Omega, and Big-O. CS3102 (DAA) 4
  • 5. Big-O Notation (O-notation) CS3102 (DAA) 5 Definition: Let g and f be functions from the set of natural numbers to itself. The function f is said to be O(g) (read big-oh of g), if there is a constant c > 0 and a natural number n0 such that f(n) ≤ cg(n) for all n ≥ n0 .
  • 6. O- big-oh notation 1<log n < √n < n < n*log n < n2 < n3 < - - - - - - -< 2n < 3n < ----<nn The Big-O Asymptotic Notation gives us the Upper Bound Idea, mathematically described below: f(n) = O(g(n)) if there exists a positive integer n0 and a positive constant c, such that f(n) ≤ cg(n) ∀ n≥n0 Example f(n) = 2n + 3
  • 8. The Gist of Big-Oh Take functions f(n) & g(n), consider only the most significant term, and remove constant multipliers: ▪ 5n+3 → n ▪ 7n+.5n2+2000 → n2 ▪ 300n+12+nlogn → n log n Then compare the functions; if f(n) ≤ g(n), then f(n) is in O(g(n)) CS3102 (DAA) 8
  • 9. More Examples 9 • Show that 30n+8 is O(n). – Show c,n0 : 30n+8  cn, n>n0 . • Let c=31, n0=8.Assume n>n0=8.Then cn = 31n = 30n + n > 30n+8, so 30n+8 < cn.
  • 10. n>n0=8 → Increasing n → Big-O example, graphically Value of function → n 30n+8 cn = 31n 10 30n+8 O(n)
  • 11. There is no unique set of values for n0 and c in proving the asymptotic bounds. Prove that 100n + 5 = O(n2) – 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 n0that satisfy the asymptotic notation relation No Uniqueness • •
  • 12. Big Oh: Common Categories From fastest to slowest O(1) constant (or O(k) for constant k) O(log n) logarithmic O(n) linear O(n log n) "n log n” O(n2) quadratic O(n3) cubic O(nk) polynomial (where is k is constant) O(kn) exponential (where constant k > 1) CS3102 (DAA) 12
  • 13. Omega Notation (Ω-notation) CS3102 (DAA) 13 Definition: Let g and f be functions from the set of natural numbers to itself. The function f is said to be Ω(g) (read Omega Notation of g), if there is a constant c > 0 and a natural number n0 such that f(n) ≥ cg(n) for all n ≥ n0.
  • 14. O- big-oh notation 1<log n < √n < n < n*log n < n2 < n3 < - - - - - - -< 2n < 3n < ----<nn The Omega Notation (Ω-notation) Notation gives us the Lower Bound Idea, mathematically described below: f(n) = Ω(g(n)) if there exists a positive integer n0 and a positive constant c, such that f(n) ≥ cg(n) ∀ n ≥ n0 Example f(n) = 2n + 3 f(n) = 5n2 + 10
  • 16. Theta Notation (Θ-notation) Definition: Let g and f be functions from the set of natural numbers to itself. The function f is said to be Θ(g) (Theta Notation of g) if there exists constant c1 and c2 > 0 and a natural number n0 such that c1g(n) ≤ f(n) ≤ c2g(n) for all n ≥ n0. CS3102 (DAA) 16
  • 17. Theta Notation (Θ-notation) 1<log n < √n < n < n*log n < n2 < n3 < - - - - - - -< 2n < 3n < ----<nn The Theta Notation (Θ-notation) gives us the Tight Bound Idea, mathematically described below: f(n) = Θ(g(n)) if there exists a positive integer n0 and a positive constant c1 and c2, such that c1g(n) ≤ f(n) ≤ c2g(n) ∀ n ≥ n0 Example f(n) = 2n + 3 f(n) = 5n2 + 10
  • 19. CS3102 (DAA) 19 Example f(n) = 2 n2 + 3n + 4 f(n) = n2 log(n) + n f(n) = n!