SlideShare a Scribd company logo
1 of 17
Download to read offline
An Overview of Algorithms
Lecture 02
Dhanushka Jayasinghe
Asymptotic Notation
 A problem may have numerous algorithmic solutions.
 In order to choose the best algorithm for a particular task, you need to be
able to judge how long a particular solution will take to run.
 Need a way to compare algorithms with one another.
 Asymptotic Complexity is a way of expressing the main component of the
cost of an algorithm, using idealized units of computational work.
Fundamentals
Solution
A1
A2
A3
A4
Asymptotic Notation
 When we study algorithms, we are interested in characterizing them
according to their efficiency.
 We are usually interesting in the order of growth of the running time of an
algorithm, not in the exact running time.
 This is also referred to as the asymptotic running time.
 We need to develop a way to talk about the rate of growth of functions so
that we can compare algorithms.
 Asymptotic notation gives us a method for classifying functions according
to their rate of growth.
Fundamentals
 How to design various algorithms for a single
solution and how to analyze them.
 What will be the time taken by each one and what
will be the memory required by each algorithm.
 Select the most suitable algorithm.
Design
Analyze
Select
Asymptotic Notation
Asymptotic Notation is a mathematical notation used to describe the asymptotic
behavior of a function.
EX:
◦ Algorithm A is twice as fast as Algorithm B
◦ If the number of items are increased by 50%
◦ Algorithm A is three times faster than Algorithm B
◦ If we have half as many items
◦ Algorithm A and B take equal time to run
Therefore we need a comparison that is related to the number of items
Asymptotic Notation
Big O Notation (O)
◦ Worst case – Upper Bound of function
Big Omega Notation (Ω)
◦ Best case – Lower Bound of function
Big Theta Notation (Ɵ)
◦ Average case
Big O Notation (O) – Upper Bound –
Worst Case
As n increases, f(n) grows no faster
than g(n).
In other words, g(n) is an asymptotic
upper bound on f(n).
n0 is threshold for given function
F(n) = O(g(n))
Input (n)
Time
(t)
f(n)
g(n)
n0
Big O Notation
If we can bind f(n) function by some other function g(n) in such a way that after
some input n0, the value of g(n) is always greater than f(n) we call g(n) the upper
bound of f(n).
Definition: f(n) = O(g(n)) if there are two positive constants c and n0 such that
|f(n)| <= c |g(n)| for all n >= n0
If f(n) is nonnegative, we can simplify the last condition to
0 <= f(n) <=c g(n) for all n >= n0
We say that “f(n) is big-O of g(n).”
Let’s we a function f(n) 2n+6,
f(n) = 2n+6
C g(n) = 4n
0 <= f(n) <=c g(n) all n >= n0
0 <= 2n+6 <= 4n , if n = 1;
1st 0 <= 8 <= 4 false
2nd 0 <= 10 <= 8 false
3rd 0 <= 12 <= 12 true
4th 0 <= 14 <= 16 true, therefor n >=3
0 <= 2n+6 <= 4n all n >=3
O ( g(n) )
C g(n) = 4n
O(n) is time complexity of f(n) 2n+6
function
Activity
Function 01
f(n) = 2n2+10
c g(n) = 3n2
Function 02
f(n) = 2n2+n
c g(n) = 3n2
Big O Notation Complexities
O (1) = Constant time
O (log n) = Logarithmic time
O (n) = Liner time
O (n log n) = Liner Arithmetic time
O (nc) = Polynomial time
O (cn) = Exponent time
O (1) < O (log n) < O (n) < O (n log n) < O (n2) < O (2n)
Big O Notation
Dominative Factor
Select the maximum complexity value
f(n) = 3n2 + n + 1
O(n2)
1. f(n) = 2 log n + n log n + n
2. f(n) = 2n + n2 + 1
Big O Notation
Insert in to an unordered array
◦ Time taken to insert an item into an unordered array is constant
◦ The time does not depend on the number of items
◦ Always time T=k
Big O Notation
Linear search
◦ Proportional to number of items N
◦ T∝ N
◦ T=k*N
THANK YOU

More Related Content

Similar to Data Structures and Algorithms - Lec 02.pdf

Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...TechVision8
 
analysis of algorithms
analysis of algorithmsanalysis of algorithms
analysis of algorithmsMyMovies15
 
Basic Computer Engineering Unit II as per RGPV Syllabus
Basic Computer Engineering Unit II as per RGPV SyllabusBasic Computer Engineering Unit II as per RGPV Syllabus
Basic Computer Engineering Unit II as per RGPV SyllabusNANDINI SHARMA
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdfMemMem25
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsKrishnan MuthuManickam
 
Algorithm And analysis Lecture 03& 04-time complexity.
 Algorithm And analysis Lecture 03& 04-time complexity. Algorithm And analysis Lecture 03& 04-time complexity.
Algorithm And analysis Lecture 03& 04-time complexity.Tariq Khan
 
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in AlgoritmInsersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in AlgoritmEhsan Ehrari
 

Similar to Data Structures and Algorithms - Lec 02.pdf (20)

Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
 
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
 
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpall...
Algorithm Class at KPHB  (C, C++ Course Training Institute in KPHB, Kukatpall...Algorithm Class at KPHB  (C, C++ Course Training Institute in KPHB, Kukatpall...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpall...
 
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
 
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
Data Structures and Algorithms Lecture 2: Analysis of Algorithms, Asymptotic ...
 
Lec1
Lec1Lec1
Lec1
 
Unit ii algorithm
Unit   ii algorithmUnit   ii algorithm
Unit ii algorithm
 
Unit 1
Unit 1Unit 1
Unit 1
 
Analysis of Algorithum
Analysis of AlgorithumAnalysis of Algorithum
Analysis of Algorithum
 
Lec7
Lec7Lec7
Lec7
 
Lec7.ppt
Lec7.pptLec7.ppt
Lec7.ppt
 
Lec7.ppt
Lec7.pptLec7.ppt
Lec7.ppt
 
analysis of algorithms
analysis of algorithmsanalysis of algorithms
analysis of algorithms
 
3 analysis.gtm
3 analysis.gtm3 analysis.gtm
3 analysis.gtm
 
Basic Computer Engineering Unit II as per RGPV Syllabus
Basic Computer Engineering Unit II as per RGPV SyllabusBasic Computer Engineering Unit II as per RGPV Syllabus
Basic Computer Engineering Unit II as per RGPV Syllabus
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
 
Algorithm And analysis Lecture 03& 04-time complexity.
 Algorithm And analysis Lecture 03& 04-time complexity. Algorithm And analysis Lecture 03& 04-time complexity.
Algorithm And analysis Lecture 03& 04-time complexity.
 
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in AlgoritmInsersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
 
Big o
Big oBig o
Big o
 

Recently uploaded

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana 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
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
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
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
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
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
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
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
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
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
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
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
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
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
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
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
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
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
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
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
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
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 

Data Structures and Algorithms - Lec 02.pdf

  • 1. An Overview of Algorithms Lecture 02 Dhanushka Jayasinghe
  • 2. Asymptotic Notation  A problem may have numerous algorithmic solutions.  In order to choose the best algorithm for a particular task, you need to be able to judge how long a particular solution will take to run.  Need a way to compare algorithms with one another.  Asymptotic Complexity is a way of expressing the main component of the cost of an algorithm, using idealized units of computational work.
  • 4. Asymptotic Notation  When we study algorithms, we are interested in characterizing them according to their efficiency.  We are usually interesting in the order of growth of the running time of an algorithm, not in the exact running time.  This is also referred to as the asymptotic running time.  We need to develop a way to talk about the rate of growth of functions so that we can compare algorithms.  Asymptotic notation gives us a method for classifying functions according to their rate of growth.
  • 5. Fundamentals  How to design various algorithms for a single solution and how to analyze them.  What will be the time taken by each one and what will be the memory required by each algorithm.  Select the most suitable algorithm. Design Analyze Select
  • 6. Asymptotic Notation Asymptotic Notation is a mathematical notation used to describe the asymptotic behavior of a function. EX: ◦ Algorithm A is twice as fast as Algorithm B ◦ If the number of items are increased by 50% ◦ Algorithm A is three times faster than Algorithm B ◦ If we have half as many items ◦ Algorithm A and B take equal time to run Therefore we need a comparison that is related to the number of items
  • 7. Asymptotic Notation Big O Notation (O) ◦ Worst case – Upper Bound of function Big Omega Notation (Ω) ◦ Best case – Lower Bound of function Big Theta Notation (Ɵ) ◦ Average case
  • 8. Big O Notation (O) – Upper Bound – Worst Case As n increases, f(n) grows no faster than g(n). In other words, g(n) is an asymptotic upper bound on f(n). n0 is threshold for given function F(n) = O(g(n)) Input (n) Time (t) f(n) g(n) n0
  • 9. Big O Notation If we can bind f(n) function by some other function g(n) in such a way that after some input n0, the value of g(n) is always greater than f(n) we call g(n) the upper bound of f(n). Definition: f(n) = O(g(n)) if there are two positive constants c and n0 such that |f(n)| <= c |g(n)| for all n >= n0 If f(n) is nonnegative, we can simplify the last condition to 0 <= f(n) <=c g(n) for all n >= n0 We say that “f(n) is big-O of g(n).”
  • 10. Let’s we a function f(n) 2n+6, f(n) = 2n+6 C g(n) = 4n 0 <= f(n) <=c g(n) all n >= n0 0 <= 2n+6 <= 4n , if n = 1; 1st 0 <= 8 <= 4 false 2nd 0 <= 10 <= 8 false 3rd 0 <= 12 <= 12 true 4th 0 <= 14 <= 16 true, therefor n >=3 0 <= 2n+6 <= 4n all n >=3 O ( g(n) ) C g(n) = 4n O(n) is time complexity of f(n) 2n+6 function
  • 11. Activity Function 01 f(n) = 2n2+10 c g(n) = 3n2 Function 02 f(n) = 2n2+n c g(n) = 3n2
  • 12. Big O Notation Complexities O (1) = Constant time O (log n) = Logarithmic time O (n) = Liner time O (n log n) = Liner Arithmetic time O (nc) = Polynomial time O (cn) = Exponent time O (1) < O (log n) < O (n) < O (n log n) < O (n2) < O (2n)
  • 14. Dominative Factor Select the maximum complexity value f(n) = 3n2 + n + 1 O(n2) 1. f(n) = 2 log n + n log n + n 2. f(n) = 2n + n2 + 1
  • 15. Big O Notation Insert in to an unordered array ◦ Time taken to insert an item into an unordered array is constant ◦ The time does not depend on the number of items ◦ Always time T=k
  • 16. Big O Notation Linear search ◦ Proportional to number of items N ◦ T∝ N ◦ T=k*N