SlideShare a Scribd company logo
1 of 2
Lecture Note-6: The Big Oh Notation 29 Jan 2016
By Rajesh K Shukla, HOD, Department of CSE, SIRTE Bhopal
Downloaded from www.RajeshkShukla.com
We need some special symbol for comparing the growth rate of functions and these special symbols are
known as asymptotic notations which are used to describe the running time of an algorithm in terms of
functions whose domains are the set of natural numbers. The asymptotic analysis of algorithm is a means of
comparing relative performances of the algorithms. We study different notations for asymptotic efficiency.
The different types of asymptotic notations are as follows
1. Big Oh or O(): This notation gives an upper bound for a function
2. Big Omega or (): This notation gives an lower bound for a function
3. Theta notation or (): This notation gives tight bound for a function
4. Little oh or o() strict upper bound: This notation gives strict upper bound for a function
5. Little omega or ω(): This notation gives strict lower bound for a function
Big Oh Notation
The Big Oh (O) is the most commonly used notation to express an algorism’s performance. The big Oh (O)
notation is a method of expressing the upper bound on the growth rate of an algorithm’s running time. In
other words we can say that it is the longest amount of time, an algorithm could possibly take to finish it
therefore the “big-Oh” or O-Notation is used for worst-case analysis of the algorithm. As we know that the
worst case of an algorithm arises when it takes maximum time to complete its execution. Let us f (n)
describes the algorithms worst case performance for some input of size n then the Big-Oh Notation can
formally be defined as follows
00 allfor)()(0andconstantspositiveexistthere:)({))(( nnncgnfsuchthatncnfngO 
“Given functions f(n) and g(n), we say that f(n) is O(g(n)) if there are positive constants c and n0 such that
f(n)  cg(n) for n  n0”
i.e. The running time of an algorithm is O(g(n)), if whenever the input size is equal to or exceeds some
threshold n0, its running time can be bounded above by some positive constant ‘c’ times g(n).
Graphical representation of Big Oh (O) notation
Lecture Note-6: The Big Oh Notation 29 Jan 2016
By Rajesh K Shukla, HOD, Department of CSE, SIRTE Bhopal
Downloaded from www.RajeshkShukla.com
The Big Oh notation can also be proved by applying the limit formula as given below
If
)(
)(
lim ng
nf
n 
exists , then functions f(n) O(g(n)) if c
ng
nf
n

 )(
)(
lim such that 0<=c<∞
Big-Oh Notation can be summarized as follows
 The Big Oh-notation is an asymptotic upper bound on the growth of an algorithm
 The big-Oh notation is used widely to characterize algorithm’s running times
 f (n) and g(n) are functions over non-negative integers
 f (n) = O(g(n)) is read as “f (n) is Big Oh of g(n)”
 f (n) is O(g(n)) if f(n) is asymptotically less than or equal to g(n)
 The statement “f (n) is Big Oh of (g(n))” means that the growth rate of f (n) is no more than the
growth rate of g(n)
Example: 2n + 7 is O(n)
Proof: We have f(n) = 2n + 7 and g(n) =n when comparing it with f(n) =O(g(n))
From the definition of Big Oh, there must exist c>0, n0  1 and onn  such that    ncgnf 0 so
   ncgnf 0
0<=2n + 7  cn for all nЄN
This is true for c=3 and n0=7 therefore 2n + 7 is O(n)
The values of c and n0 are obtained as follows
(c  2) n  7>=0
n  7/(c  2) so we may choose c = 3 that results in n0 = 7
Example: 2(n + 1)
is O(2n
)
Proof: We have f(n) = 2(n + 1)
and g(n) =2n
when comparing it with f(n) =O(g(n))
From the definition of Big Oh, there must exist c>0, n0  1 and onn  such that    ncgnf 0 so 0<=2(n +
1)
 c2n
for any constant c and all onn  where n0 and nЄN
0<=2(n + 1)
 c.2n
this inequality holds for c=2 so
0<=2(n + 1)
 2.2n
Therefore 2(n + 1)
=O(2n
)
This can also be proved using the limit of functions
c
ng
nf
if
n

 )(
)(
lim
where 0<=c<∞
cn
n
n


 2
12
lim
cn
n
n

 2
2.2
lim
=2 (constant>0) hence 2(n + 1)
is O(2n
)

More Related Content

What's hot

Nyquist Stability Criterion
Nyquist  Stability CriterionNyquist  Stability Criterion
Nyquist Stability CriterionHussain K
 
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価Kota Abe
 
formal definitions in theory of computation
formal definitions in theory of computationformal definitions in theory of computation
formal definitions in theory of computationkanikkk
 
lecture 6
lecture 6lecture 6
lecture 6sajinsc
 
An adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate recordsAn adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate recordsLikan Patra
 
lecture 5
lecture 5lecture 5
lecture 5sajinsc
 
Pert management
Pert management Pert management
Pert management Ahmed Gamal
 
Lecture 3 tangent & velocity problems
Lecture 3   tangent & velocity problemsLecture 3   tangent & velocity problems
Lecture 3 tangent & velocity problemsnjit-ronbrown
 
Ece512 h1 20139_621386735458ece512_test2_solutions
Ece512 h1 20139_621386735458ece512_test2_solutionsEce512 h1 20139_621386735458ece512_test2_solutions
Ece512 h1 20139_621386735458ece512_test2_solutionsnadia abd
 
Research_Presentation
Research_PresentationResearch_Presentation
Research_PresentationBridget Jones
 
Convex Hull Algorithm Analysis
Convex Hull Algorithm AnalysisConvex Hull Algorithm Analysis
Convex Hull Algorithm AnalysisRex Yuan
 
Algebra 2 unit 9.1
Algebra 2 unit 9.1Algebra 2 unit 9.1
Algebra 2 unit 9.1Mark Ryder
 

What's hot (20)

Big o notation
Big o notationBig o notation
Big o notation
 
Nyquist Stability Criterion
Nyquist  Stability CriterionNyquist  Stability Criterion
Nyquist Stability Criterion
 
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
 
formal definitions in theory of computation
formal definitions in theory of computationformal definitions in theory of computation
formal definitions in theory of computation
 
lecture 6
lecture 6lecture 6
lecture 6
 
An adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate recordsAn adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate records
 
lecture 5
lecture 5lecture 5
lecture 5
 
Big O Notation
Big O NotationBig O Notation
Big O Notation
 
C++ training day01
C++ training day01C++ training day01
C++ training day01
 
C++ day2
C++ day2C++ day2
C++ day2
 
Pert management
Pert management Pert management
Pert management
 
Lecture 3 tangent & velocity problems
Lecture 3   tangent & velocity problemsLecture 3   tangent & velocity problems
Lecture 3 tangent & velocity problems
 
Ece512 h1 20139_621386735458ece512_test2_solutions
Ece512 h1 20139_621386735458ece512_test2_solutionsEce512 h1 20139_621386735458ece512_test2_solutions
Ece512 h1 20139_621386735458ece512_test2_solutions
 
Research_Presentation
Research_PresentationResearch_Presentation
Research_Presentation
 
Convex hulls & Chan's algorithm
Convex hulls & Chan's algorithmConvex hulls & Chan's algorithm
Convex hulls & Chan's algorithm
 
Convex Hull Algorithm Analysis
Convex Hull Algorithm AnalysisConvex Hull Algorithm Analysis
Convex Hull Algorithm Analysis
 
Slides
SlidesSlides
Slides
 
Module 2 topic 2 notes
Module 2 topic 2 notesModule 2 topic 2 notes
Module 2 topic 2 notes
 
Algebra 2 unit 9.1
Algebra 2 unit 9.1Algebra 2 unit 9.1
Algebra 2 unit 9.1
 
Concept of c
Concept of cConcept of c
Concept of c
 

Similar to The bog oh notation

Little o and little omega
Little o and little omegaLittle o and little omega
Little o and little omegaRajesh K Shukla
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic NotationsNagendraK18
 
Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfShaistaRiaz4
 
Analysis Of Algorithms I
Analysis Of Algorithms IAnalysis Of Algorithms I
Analysis Of Algorithms ISri Prasanna
 
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
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsNikhil Sharma
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and ComplexityRajandeep Gill
 
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
 
asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations iAli mahmood
 
04. Growth_Rate_AND_Asymptotic Notations_.pptx
04. Growth_Rate_AND_Asymptotic Notations_.pptx04. Growth_Rate_AND_Asymptotic Notations_.pptx
04. Growth_Rate_AND_Asymptotic Notations_.pptxarslanzaheer14
 
Weekends with Competitive Programming
Weekends with Competitive ProgrammingWeekends with Competitive Programming
Weekends with Competitive ProgrammingNiharikaSingh839269
 
Daa unit 6_efficiency of algorithms
Daa unit 6_efficiency of algorithmsDaa unit 6_efficiency of algorithms
Daa unit 6_efficiency of algorithmssnehajiyani
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsEhtisham Ali
 

Similar to The bog oh notation (20)

Big omega
Big omegaBig omega
Big omega
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Little o and little omega
Little o and little omegaLittle o and little omega
Little o and little omega
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdf
 
Theta notation
Theta notationTheta notation
Theta notation
 
Big o
Big oBig o
Big o
 
Analysis Of Algorithms I
Analysis Of Algorithms IAnalysis Of Algorithms I
Analysis Of Algorithms I
 
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
 
big_oh
big_ohbig_oh
big_oh
 
algorithm_analysis1
algorithm_analysis1algorithm_analysis1
algorithm_analysis1
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and Complexity
 
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
 
asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations i
 
04. Growth_Rate_AND_Asymptotic Notations_.pptx
04. Growth_Rate_AND_Asymptotic Notations_.pptx04. Growth_Rate_AND_Asymptotic Notations_.pptx
04. Growth_Rate_AND_Asymptotic Notations_.pptx
 
Weekends with Competitive Programming
Weekends with Competitive ProgrammingWeekends with Competitive Programming
Weekends with Competitive Programming
 
Daa unit 6_efficiency of algorithms
Daa unit 6_efficiency of algorithmsDaa unit 6_efficiency of algorithms
Daa unit 6_efficiency of algorithms
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 

More from Rajesh K Shukla

Stack: Recursion and Iteration
Stack: Recursion and IterationStack: Recursion and Iteration
Stack: Recursion and IterationRajesh K Shukla
 
Lecture Note-1: Algorithm and Its Properties
Lecture Note-1: Algorithm and Its PropertiesLecture Note-1: Algorithm and Its Properties
Lecture Note-1: Algorithm and Its PropertiesRajesh K Shukla
 
Lecture Note-2: Performance analysis of Algorithms
Lecture Note-2: Performance analysis of AlgorithmsLecture Note-2: Performance analysis of Algorithms
Lecture Note-2: Performance analysis of AlgorithmsRajesh K Shukla
 

More from Rajesh K Shukla (6)

Quiz 2
Quiz 2Quiz 2
Quiz 2
 
Quiz 1
Quiz 1Quiz 1
Quiz 1
 
Pop operation
Pop operationPop operation
Pop operation
 
Stack: Recursion and Iteration
Stack: Recursion and IterationStack: Recursion and Iteration
Stack: Recursion and Iteration
 
Lecture Note-1: Algorithm and Its Properties
Lecture Note-1: Algorithm and Its PropertiesLecture Note-1: Algorithm and Its Properties
Lecture Note-1: Algorithm and Its Properties
 
Lecture Note-2: Performance analysis of Algorithms
Lecture Note-2: Performance analysis of AlgorithmsLecture Note-2: Performance analysis of Algorithms
Lecture Note-2: Performance analysis of Algorithms
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Recently uploaded (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

The bog oh notation

  • 1. Lecture Note-6: The Big Oh Notation 29 Jan 2016 By Rajesh K Shukla, HOD, Department of CSE, SIRTE Bhopal Downloaded from www.RajeshkShukla.com We need some special symbol for comparing the growth rate of functions and these special symbols are known as asymptotic notations which are used to describe the running time of an algorithm in terms of functions whose domains are the set of natural numbers. The asymptotic analysis of algorithm is a means of comparing relative performances of the algorithms. We study different notations for asymptotic efficiency. The different types of asymptotic notations are as follows 1. Big Oh or O(): This notation gives an upper bound for a function 2. Big Omega or (): This notation gives an lower bound for a function 3. Theta notation or (): This notation gives tight bound for a function 4. Little oh or o() strict upper bound: This notation gives strict upper bound for a function 5. Little omega or ω(): This notation gives strict lower bound for a function Big Oh Notation The Big Oh (O) is the most commonly used notation to express an algorism’s performance. The big Oh (O) notation is a method of expressing the upper bound on the growth rate of an algorithm’s running time. In other words we can say that it is the longest amount of time, an algorithm could possibly take to finish it therefore the “big-Oh” or O-Notation is used for worst-case analysis of the algorithm. As we know that the worst case of an algorithm arises when it takes maximum time to complete its execution. Let us f (n) describes the algorithms worst case performance for some input of size n then the Big-Oh Notation can formally be defined as follows 00 allfor)()(0andconstantspositiveexistthere:)({))(( nnncgnfsuchthatncnfngO  “Given functions f(n) and g(n), we say that f(n) is O(g(n)) if there are positive constants c and n0 such that f(n)  cg(n) for n  n0” i.e. The running time of an algorithm is O(g(n)), if whenever the input size is equal to or exceeds some threshold n0, its running time can be bounded above by some positive constant ‘c’ times g(n). Graphical representation of Big Oh (O) notation
  • 2. Lecture Note-6: The Big Oh Notation 29 Jan 2016 By Rajesh K Shukla, HOD, Department of CSE, SIRTE Bhopal Downloaded from www.RajeshkShukla.com The Big Oh notation can also be proved by applying the limit formula as given below If )( )( lim ng nf n  exists , then functions f(n) O(g(n)) if c ng nf n   )( )( lim such that 0<=c<∞ Big-Oh Notation can be summarized as follows  The Big Oh-notation is an asymptotic upper bound on the growth of an algorithm  The big-Oh notation is used widely to characterize algorithm’s running times  f (n) and g(n) are functions over non-negative integers  f (n) = O(g(n)) is read as “f (n) is Big Oh of g(n)”  f (n) is O(g(n)) if f(n) is asymptotically less than or equal to g(n)  The statement “f (n) is Big Oh of (g(n))” means that the growth rate of f (n) is no more than the growth rate of g(n) Example: 2n + 7 is O(n) Proof: We have f(n) = 2n + 7 and g(n) =n when comparing it with f(n) =O(g(n)) From the definition of Big Oh, there must exist c>0, n0  1 and onn  such that    ncgnf 0 so    ncgnf 0 0<=2n + 7  cn for all nЄN This is true for c=3 and n0=7 therefore 2n + 7 is O(n) The values of c and n0 are obtained as follows (c  2) n  7>=0 n  7/(c  2) so we may choose c = 3 that results in n0 = 7 Example: 2(n + 1) is O(2n ) Proof: We have f(n) = 2(n + 1) and g(n) =2n when comparing it with f(n) =O(g(n)) From the definition of Big Oh, there must exist c>0, n0  1 and onn  such that    ncgnf 0 so 0<=2(n + 1)  c2n for any constant c and all onn  where n0 and nЄN 0<=2(n + 1)  c.2n this inequality holds for c=2 so 0<=2(n + 1)  2.2n Therefore 2(n + 1) =O(2n ) This can also be proved using the limit of functions c ng nf if n   )( )( lim where 0<=c<∞ cn n n    2 12 lim cn n n   2 2.2 lim =2 (constant>0) hence 2(n + 1) is O(2n )