SlideShare a Scribd company logo
1 of 9
Lecture 3
Advanced Data structures
&
Analysis of Algorithms
Abirami S
Asst.Prof. IT Dept.
Shah and Anchor Kutchhi Engineering
College, Mumbai
Time Complexity
T1
Execution Time
Input output
0
1
2
3
4
5
6
1 2 3 4 5 6 7
Growth of a Function
Input
Time
F(n)
Time
T1
T2
T3
.
.
Tn
Input
1
2
3
.
.
n
How to calculate the time complexity
• The running time of an algorithm depends on
the following factors
– Single Vs multiprocessor
– Read/write speed of memory
– 32 bit architecture Vs 64 bit architecture
– Input size
How to calculate the rate of growth of
an algorithm with respect to the input:
• For the calculation purpose, a model machine to be
considered with an assumption of Single processor, 32 bit
architecture, and sequential execution of the Read/Write
operation and the unit of time taken by the arithmetic &
logical operations, assignment operations and return
statement are considered as one.
• Examples 1:
– Sum (a ,b)
– {
– Return a + b
– }
• In the above example, the return statement takes 1 unit of
time; the addition operation takes 1 unit of time. So, the
total time taken is 2 units.
Constant Growth
• As per the above, the algorithm grows on
constant time.
• Tn=1
0
0.5
1
1.5
2
2.5
1 2 3 4 5 6 7 8 9 10 11 12 13
RateofGrowthT
Input size n
Rate of Growth of Algorithm
Constant Growth
Examples 2:
Statement No. Cost of Execution Time taken in
unit of 1
1 Sum=0; 1 (C1) 1
2 For n=0 to n-1 2 (C2) n+1
3 Sum=sum + A[i]; 2 (C3) n
4 Return Sum 1(C4) 1
Sum (Sum of elements of array A, n)
{
}
As per the above, the algorithm grows as follows,
Tn = 1+2(n+1) + 2n+1
= 4n + 4
= Cn + C` [C= C2+C3 & C`=C1+C2+C4]
Linear growth
0
2
4
6
8
10
12
14
16
18
1 2 3 4 5 6 7
RateofGrowthT
Input size n
Rate of Growth of Algorithm
Linear Growth
Example 3:
For “Sum of Matrix “the expression will be
Tn= an2+bn+c
The growth of the algorithm is in the quadratic manner.
0
5
10
15
20
25
30
35
1 2 3 4 5
RateofGrowthT
Input size n
Rate of Growth of Algorithm
Quadratic Growth
Thank You

More Related Content

What's hot

Pa1 wednesday flow_chart
Pa1 wednesday flow_chartPa1 wednesday flow_chart
Pa1 wednesday flow_chartaiclub_slides
 
Arithmetic Operations
Arithmetic OperationsArithmetic Operations
Arithmetic Operationsgueste99d9a
 
Bca 2nd sem-u-1.3 digital logic circuits, digital component
Bca 2nd sem-u-1.3 digital logic circuits, digital componentBca 2nd sem-u-1.3 digital logic circuits, digital component
Bca 2nd sem-u-1.3 digital logic circuits, digital componentRai University
 
02 order of growth
02 order of growth02 order of growth
02 order of growthHira Gul
 
Sequential multiplication
Sequential multiplicationSequential multiplication
Sequential multiplicationTaqwa It Center
 
Job sequencing with Deadlines
Job sequencing with DeadlinesJob sequencing with Deadlines
Job sequencing with DeadlinesYashiUpadhyay3
 
Exercise6 ch2
Exercise6 ch2Exercise6 ch2
Exercise6 ch2IIUM
 
Python project2
Python project2Python project2
Python project2Young Song
 
Arithmetic micro operations
Arithmetic micro operationsArithmetic micro operations
Arithmetic micro operationsNitesh Bichwani
 
Python project
Python projectPython project
Python projectYoung Song
 
Project duration and staffing
Project duration and staffingProject duration and staffing
Project duration and staffingsiva R
 
November 9, 2015
November 9, 2015November 9, 2015
November 9, 2015khyps13
 
Study of life time of muons
Study of life time of muonsStudy of life time of muons
Study of life time of muonsTom Loughran
 
1's and 2's Complements
1's and 2's Complements 1's and 2's Complements
1's and 2's Complements ZareenRauf1
 

What's hot (20)

Cs 1114 - lecture-2
Cs 1114 - lecture-2Cs 1114 - lecture-2
Cs 1114 - lecture-2
 
Pa1 wednesday flow_chart
Pa1 wednesday flow_chartPa1 wednesday flow_chart
Pa1 wednesday flow_chart
 
Arithmetic Operations
Arithmetic OperationsArithmetic Operations
Arithmetic Operations
 
Bca 2nd sem-u-1.3 digital logic circuits, digital component
Bca 2nd sem-u-1.3 digital logic circuits, digital componentBca 2nd sem-u-1.3 digital logic circuits, digital component
Bca 2nd sem-u-1.3 digital logic circuits, digital component
 
computer arithmatic
computer arithmaticcomputer arithmatic
computer arithmatic
 
02 order of growth
02 order of growth02 order of growth
02 order of growth
 
Sequential multiplication
Sequential multiplicationSequential multiplication
Sequential multiplication
 
Job sequencing with Deadlines
Job sequencing with DeadlinesJob sequencing with Deadlines
Job sequencing with Deadlines
 
Exercise6 ch2
Exercise6 ch2Exercise6 ch2
Exercise6 ch2
 
Python project2
Python project2Python project2
Python project2
 
Arithmetic micro operations
Arithmetic micro operationsArithmetic micro operations
Arithmetic micro operations
 
Python project
Python projectPython project
Python project
 
Project duration and staffing
Project duration and staffingProject duration and staffing
Project duration and staffing
 
November 9, 2015
November 9, 2015November 9, 2015
November 9, 2015
 
Study of life time of muons
Study of life time of muonsStudy of life time of muons
Study of life time of muons
 
Ch03pp
Ch03ppCh03pp
Ch03pp
 
CHAPTER 3 - LESSON C
CHAPTER 3 - LESSON CCHAPTER 3 - LESSON C
CHAPTER 3 - LESSON C
 
1's and 2's Complements
1's and 2's Complements 1's and 2's Complements
1's and 2's Complements
 
Lecture 1 python arithmetic (ewurc)
Lecture 1 python arithmetic (ewurc)Lecture 1 python arithmetic (ewurc)
Lecture 1 python arithmetic (ewurc)
 
Logaritmos
LogaritmosLogaritmos
Logaritmos
 

Similar to Lecture 3 time complexity

algorithmanalysis and effciency.pptx
algorithmanalysis and effciency.pptxalgorithmanalysis and effciency.pptx
algorithmanalysis and effciency.pptxChSreenivasuluReddy
 
Ch1. Analysis of Algorithms.pdf
Ch1. Analysis of Algorithms.pdfCh1. Analysis of Algorithms.pdf
Ch1. Analysis of Algorithms.pdfzoric99
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithmsiqbalphy1
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencySaranya Natarajan
 
CS-102 DS-class_01_02 Lectures Data .pdf
CS-102 DS-class_01_02 Lectures Data .pdfCS-102 DS-class_01_02 Lectures Data .pdf
CS-102 DS-class_01_02 Lectures Data .pdfssuser034ce1
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysisAkshay Dagar
 
Data Structure & Algorithms - Mathematical
Data Structure & Algorithms - MathematicalData Structure & Algorithms - Mathematical
Data Structure & Algorithms - Mathematicalbabuk110
 
Lecture 3 insertion sort and complexity analysis
Lecture 3   insertion sort and complexity analysisLecture 3   insertion sort and complexity analysis
Lecture 3 insertion sort and complexity analysisjayavignesh86
 
Chapter One.pdf
Chapter One.pdfChapter One.pdf
Chapter One.pdfabay golla
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysissumitbardhan
 
Data Structures and Algorithm - Week 11 - Algorithm Analysis
Data Structures and Algorithm - Week 11 - Algorithm AnalysisData Structures and Algorithm - Week 11 - Algorithm Analysis
Data Structures and Algorithm - Week 11 - Algorithm AnalysisFerdin Joe John Joseph PhD
 
Analysis of algorithn class 2
Analysis of algorithn class 2Analysis of algorithn class 2
Analysis of algorithn class 2Kumar
 
Analysis of Algorithm full version 2024.pptx
Analysis of Algorithm  full version  2024.pptxAnalysis of Algorithm  full version  2024.pptx
Analysis of Algorithm full version 2024.pptxrajesshs31r
 
Design Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptxDesign Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptxrajesshs31r
 
ALGORITHM-ANALYSIS.ppt
ALGORITHM-ANALYSIS.pptALGORITHM-ANALYSIS.ppt
ALGORITHM-ANALYSIS.pptsapnaverma97
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
Analysis and Algorithms: basic Introduction
Analysis and Algorithms: basic IntroductionAnalysis and Algorithms: basic Introduction
Analysis and Algorithms: basic Introductionssuseraf8b2f
 

Similar to Lecture 3 time complexity (20)

algorithmanalysis and effciency.pptx
algorithmanalysis and effciency.pptxalgorithmanalysis and effciency.pptx
algorithmanalysis and effciency.pptx
 
Ch1. Analysis of Algorithms.pdf
Ch1. Analysis of Algorithms.pdfCh1. Analysis of Algorithms.pdf
Ch1. Analysis of Algorithms.pdf
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm Efficiency
 
CS-102 DS-class_01_02 Lectures Data .pdf
CS-102 DS-class_01_02 Lectures Data .pdfCS-102 DS-class_01_02 Lectures Data .pdf
CS-102 DS-class_01_02 Lectures Data .pdf
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 
Data Structure & Algorithms - Mathematical
Data Structure & Algorithms - MathematicalData Structure & Algorithms - Mathematical
Data Structure & Algorithms - Mathematical
 
Lecture 3 insertion sort and complexity analysis
Lecture 3   insertion sort and complexity analysisLecture 3   insertion sort and complexity analysis
Lecture 3 insertion sort and complexity analysis
 
Chapter One.pdf
Chapter One.pdfChapter One.pdf
Chapter One.pdf
 
Analysis of algo
Analysis of algoAnalysis of algo
Analysis of algo
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 
Data Structures and Algorithm - Week 11 - Algorithm Analysis
Data Structures and Algorithm - Week 11 - Algorithm AnalysisData Structures and Algorithm - Week 11 - Algorithm Analysis
Data Structures and Algorithm - Week 11 - Algorithm Analysis
 
Analysis of algorithn class 2
Analysis of algorithn class 2Analysis of algorithn class 2
Analysis of algorithn class 2
 
Analysis of Algorithm full version 2024.pptx
Analysis of Algorithm  full version  2024.pptxAnalysis of Algorithm  full version  2024.pptx
Analysis of Algorithm full version 2024.pptx
 
Design Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptxDesign Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptx
 
ALGORITHM-ANALYSIS.ppt
ALGORITHM-ANALYSIS.pptALGORITHM-ANALYSIS.ppt
ALGORITHM-ANALYSIS.ppt
 
Cis435 week01
Cis435 week01Cis435 week01
Cis435 week01
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Algorithms
Algorithms Algorithms
Algorithms
 
Analysis and Algorithms: basic Introduction
Analysis and Algorithms: basic IntroductionAnalysis and Algorithms: basic Introduction
Analysis and Algorithms: basic Introduction
 

More from Abirami A

Lecture 2 Data Structure Introduction
Lecture 2 Data Structure IntroductionLecture 2 Data Structure Introduction
Lecture 2 Data Structure IntroductionAbirami A
 
Lecture 1 introduction
Lecture 1 introductionLecture 1 introduction
Lecture 1 introductionAbirami A
 
Lecture 14 splay tree
Lecture 14 splay treeLecture 14 splay tree
Lecture 14 splay treeAbirami A
 
Lecture 16 graphs traversal
Lecture 16 graphs traversalLecture 16 graphs traversal
Lecture 16 graphs traversalAbirami A
 
Lecture 16 graph introduction
Lecture 16 graph introductionLecture 16 graph introduction
Lecture 16 graph introductionAbirami A
 
Lecture 6 disjoint set
Lecture 6 disjoint setLecture 6 disjoint set
Lecture 6 disjoint setAbirami A
 
Lecture 8 tree traversal
Lecture 8 tree traversalLecture 8 tree traversal
Lecture 8 tree traversalAbirami A
 
Lecture 9 b tree
Lecture 9 b treeLecture 9 b tree
Lecture 9 b treeAbirami A
 
Lecture 7 bst
Lecture 7 bstLecture 7 bst
Lecture 7 bstAbirami A
 
Lecture 6 tree traversal
Lecture 6 tree traversalLecture 6 tree traversal
Lecture 6 tree traversalAbirami A
 
Lecture 5 tree.pptx
Lecture 5 tree.pptxLecture 5 tree.pptx
Lecture 5 tree.pptxAbirami A
 
Lecture 1 sorting insertion & shell sort
Lecture 1 sorting insertion & shell sortLecture 1 sorting insertion & shell sort
Lecture 1 sorting insertion & shell sortAbirami A
 

More from Abirami A (12)

Lecture 2 Data Structure Introduction
Lecture 2 Data Structure IntroductionLecture 2 Data Structure Introduction
Lecture 2 Data Structure Introduction
 
Lecture 1 introduction
Lecture 1 introductionLecture 1 introduction
Lecture 1 introduction
 
Lecture 14 splay tree
Lecture 14 splay treeLecture 14 splay tree
Lecture 14 splay tree
 
Lecture 16 graphs traversal
Lecture 16 graphs traversalLecture 16 graphs traversal
Lecture 16 graphs traversal
 
Lecture 16 graph introduction
Lecture 16 graph introductionLecture 16 graph introduction
Lecture 16 graph introduction
 
Lecture 6 disjoint set
Lecture 6 disjoint setLecture 6 disjoint set
Lecture 6 disjoint set
 
Lecture 8 tree traversal
Lecture 8 tree traversalLecture 8 tree traversal
Lecture 8 tree traversal
 
Lecture 9 b tree
Lecture 9 b treeLecture 9 b tree
Lecture 9 b tree
 
Lecture 7 bst
Lecture 7 bstLecture 7 bst
Lecture 7 bst
 
Lecture 6 tree traversal
Lecture 6 tree traversalLecture 6 tree traversal
Lecture 6 tree traversal
 
Lecture 5 tree.pptx
Lecture 5 tree.pptxLecture 5 tree.pptx
Lecture 5 tree.pptx
 
Lecture 1 sorting insertion & shell sort
Lecture 1 sorting insertion & shell sortLecture 1 sorting insertion & shell sort
Lecture 1 sorting insertion & shell sort
 

Recently uploaded

Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
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
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(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
 
(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
 
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
 
(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
 
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
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
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
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 

Recently uploaded (20)

Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
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
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(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...
 
(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...
 
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...
 
(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...
 
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
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
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
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
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
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 

Lecture 3 time complexity

  • 1. Lecture 3 Advanced Data structures & Analysis of Algorithms Abirami S Asst.Prof. IT Dept. Shah and Anchor Kutchhi Engineering College, Mumbai
  • 2. Time Complexity T1 Execution Time Input output 0 1 2 3 4 5 6 1 2 3 4 5 6 7 Growth of a Function Input Time F(n) Time T1 T2 T3 . . Tn Input 1 2 3 . . n
  • 3. How to calculate the time complexity • The running time of an algorithm depends on the following factors – Single Vs multiprocessor – Read/write speed of memory – 32 bit architecture Vs 64 bit architecture – Input size
  • 4. How to calculate the rate of growth of an algorithm with respect to the input: • For the calculation purpose, a model machine to be considered with an assumption of Single processor, 32 bit architecture, and sequential execution of the Read/Write operation and the unit of time taken by the arithmetic & logical operations, assignment operations and return statement are considered as one. • Examples 1: – Sum (a ,b) – { – Return a + b – } • In the above example, the return statement takes 1 unit of time; the addition operation takes 1 unit of time. So, the total time taken is 2 units.
  • 5. Constant Growth • As per the above, the algorithm grows on constant time. • Tn=1 0 0.5 1 1.5 2 2.5 1 2 3 4 5 6 7 8 9 10 11 12 13 RateofGrowthT Input size n Rate of Growth of Algorithm Constant Growth
  • 6. Examples 2: Statement No. Cost of Execution Time taken in unit of 1 1 Sum=0; 1 (C1) 1 2 For n=0 to n-1 2 (C2) n+1 3 Sum=sum + A[i]; 2 (C3) n 4 Return Sum 1(C4) 1 Sum (Sum of elements of array A, n) { } As per the above, the algorithm grows as follows, Tn = 1+2(n+1) + 2n+1 = 4n + 4 = Cn + C` [C= C2+C3 & C`=C1+C2+C4]
  • 7. Linear growth 0 2 4 6 8 10 12 14 16 18 1 2 3 4 5 6 7 RateofGrowthT Input size n Rate of Growth of Algorithm Linear Growth
  • 8. Example 3: For “Sum of Matrix “the expression will be Tn= an2+bn+c The growth of the algorithm is in the quadratic manner. 0 5 10 15 20 25 30 35 1 2 3 4 5 RateofGrowthT Input size n Rate of Growth of Algorithm Quadratic Growth