SlideShare a Scribd company logo
1 of 13
Download to read offline
Program: BE (Computer Engineering & Information Technology)
Class: TE
Course: Design and Analysis of Algorithm
Unit 01: Introduction to DAA
Lecture 02: Analysis of Algorithm and Asymptotic Notations
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Analysis of Algorithm
 In designing of Algorithm, complexity analysis of an algorithm is
an essential aspect.
 Mainly, algorithmic complexity is concerned about its
performance, how fast or slow it works.
 There are many criteria upon which the performance of an
Algorithm can be decided like,
 Does it do what we want it to do?
 Does it work correctly according to the original specifications
of the task?
 Is there documentation that describes how to use it & how it
works?
 Are procedures creates in such a way that they perform logical
sub functions?
 Is the code readable?
04
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Analysis of Algorithm
 These criteria are all vitally important when it comes to write or
design the software’s for a large system.
 But the most important factors for measure the performance of an
Algorithm by computing two factors.,
 Amount of time required by an Algorithm to execute i. e. Time
Complexity.
 Amount of space required by an Algorithm i. e. Space
Complexity.
05
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Analysis of Algorithm
1. Time Complexity
 The time complexity of an Algorithm is the amount of computer
time required by an Algorithm to run to completion.
 It is difficult to compute the time complexity in terms of physical
clocked time.
 For instance in multiuser system, executing time depends on many
factors such as,
 System Load.
 Number of other programs running.
 Instruction set used.
 Speed of underlying hardware.
 The time complexity is therefore given of frequency count.
06
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Analysis of Algorithm
1. Time Complexity
 Frequency count is a count denoting number of time of execution of
statement.
 If the input size is longer, then usually Algorithm runs for a longer
time.
 Time Complexity denoted by,
T(n) = Cop * C(n)
Where,
T(n) = Running Time of basic operation.
Cop = Time taken by the basic operation to execute.
C(n) = Number of times the operation needs to be executed.
07
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Analysis of Algorithm
2. Space Complexity
 The space complexity of an Algorithm is the amount
memory required by an Algorithm to run.
 It’s a function describing the amount of memory an
algorithm takes in terms of the size of input to the
algorithm. We often speak of "extra" memory needed,
not counting the memory needed to store the input itself.
 Space complexity is sometimes ignored because the
space used is minimal and/or obvious, however
sometimes it becomes as important an issue as time.
 Space complexity depends upon two factors,
 Constant Characteristics.
 Instance Characteristics.
08
 Space Complexity denoted by,
S(p) = C + Sp
Where,
S(p) = Space Complexity.
C = Constant.
Sp = space dependent upon instance
characteristics.
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Analysis of Algorithm
Best Case, Worst Case, & Average Case Analysis
Best Case
 If an Algorithm takes minimum amount of time to run to
completion for a specific set of input then it is called as Best
Case Time complexity.
 Best Case Time Complexity denoted as,
Cbest = 1
Example: While searching a particular element by using
sequential search we get the desired element at first place
itself then it is the best case.
09
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Analysis of Algorithm
Best Case, Worst Case, & Average Case Analysis
Worst Case
 If an Algorithm takes maximum amount of time to run to
completion for a specific set of input then it is called as Worst
Case Time complexity.
 Worst Case Time Complexity denoted as,
Cworst = n
Example: While searching an element by using liner searching
methods if desired element is placed at the end of the list then
we get the Worst Case Time Complexity.
10
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Analysis of Algorithm
Best Case, Worst Case, & Average Case Analysis
Average Case
 The Time Complexity for certain set of inputs is as a average
same. Then for corresponding input such a time complexity is
called Average Case Time Complexity.
 For calculating Average Case Time Complexity we have to
consider probability of getting success of the operation.
 Any operation in the Algorithm is heavily dependent on input
elements.
 Thus computing Average Case Time Complexity is difficult
than computing Worst Case & Best Case Time Complexity
 Average Case Time Complexity denoted as,
Cavg (n) = (n+1)/2
11
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Asymptotic Notations
 Execution time of an algorithm depends on the instruction set,
processor speed, disk I/O speed, etc. Hence, it estimate the efficiency
of an algorithm asymptotically.
 To choose the best Algorithm, we need to check the efficiency of
each Algorithm. The efficiency can be measured by computing Time
Complexity of each Algorithm.
 Asymptotic notation is a shorthand way to represent the Time
Complexity.
 Using the Asymptotic notations we can give Time Complexity as
“Fastest Possible”, “Slowest Possible”, or Average Time”.
 Following asymptotic notations are used to calculate the running time
complexity of an algorithm.
1. Big Oh (O)
2. Omega (Ω)
3. Theta (θ)
12
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Asymptotic Notations
1. Big Oh (O) : Asymptotic Lower Bound
 It is a method of representing the upper bound of algorithm’s running
time.
 Big oh notation is used to find the longest amount of time taken by
the Algorithm to complete.
 Let f(n) & g(n) be two non-negative functions. Let n0 & constant C
are two integers, such that n0 denotes some value of input & n > n0.
Similarly C is some constant such that C > 0.
 We can write,
f(n) ≤ C * g(n)
 Then f(n) is Big Oh of g(n). it is also denoted as f(n) € O(g(n)).
 In other words f(n) is less than g(n), if g(n) is multiple of some
constant C.
13
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Asymptotic Notations
2. Omega (Ω)
 It is used to represent the lower bound of Algorithm’s running time.
 It also denotes the shortest amount of time taken by Algorithm.
 A function f(n) is said to be in Ω(g(n)), if f(n) is bounded by some
positive constant multiple of g(n) such that,
f(n) ≥ C * g(n) for all n > n0
 It is denoted as f(n) € Ω (g(n)).
14
www.sandipuniversity.edu.in www.sandipfoundation.org
Department of Computer Engineering & Information Technology, SITRC, Nashik
Asymptotic Notations
3. Theta (θ)
 It shows the running time is between upper bound and lower bound.
 Let f(n) and g(n) be two non negative functions, there are two
constants namely c1 and c2 such that,
c2 g(n) ≤ f(n) ≤ c1 g(n)
 It is denoted as f(n) € (g(n)).
15

More Related Content

Similar to DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf

Chapter 1 Data structure.pptx
Chapter 1 Data structure.pptxChapter 1 Data structure.pptx
Chapter 1 Data structure.pptxwondmhunegn
 
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
 
Aad introduction
Aad introductionAad introduction
Aad introductionMr SMAK
 
Algorithms : Introduction and Analysis
Algorithms : Introduction and AnalysisAlgorithms : Introduction and Analysis
Algorithms : Introduction and AnalysisDhrumil Patel
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to AlgorithmsVenkatesh Iyer
 
Algorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structureAlgorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structureVrushali Dhanokar
 
Data Structures Notes
Data Structures NotesData Structures Notes
Data Structures NotesRobinRohit2
 
algocomplexity cost effective tradeoff in
algocomplexity cost effective tradeoff inalgocomplexity cost effective tradeoff in
algocomplexity cost effective tradeoff injaved75
 
presentationfinal-090714235255-phpapp01 (1) (2).pptx
presentationfinal-090714235255-phpapp01 (1) (2).pptxpresentationfinal-090714235255-phpapp01 (1) (2).pptx
presentationfinal-090714235255-phpapp01 (1) (2).pptxjaved75
 
A Heterogeneous Static Hierarchical Expected Completion Time Based Scheduling...
A Heterogeneous Static Hierarchical Expected Completion Time Based Scheduling...A Heterogeneous Static Hierarchical Expected Completion Time Based Scheduling...
A Heterogeneous Static Hierarchical Expected Completion Time Based Scheduling...IRJET Journal
 
Asymptotic Analysis in Data Structure using C
Asymptotic Analysis in Data Structure using CAsymptotic Analysis in Data Structure using C
Asymptotic Analysis in Data Structure using CMeghaj Mallick
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...AntareepMajumder
 
CCS 3102 Lecture 3_ Complexity theory.pdf
CCS 3102 Lecture 3_ Complexity theory.pdfCCS 3102 Lecture 3_ Complexity theory.pdf
CCS 3102 Lecture 3_ Complexity theory.pdfJosephKariuki46
 
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
 

Similar to DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf (20)

Chapter 1 Data structure.pptx
Chapter 1 Data structure.pptxChapter 1 Data structure.pptx
Chapter 1 Data structure.pptx
 
Analyzing algorithms
Analyzing algorithmsAnalyzing algorithms
Analyzing algorithms
 
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
 
Aad introduction
Aad introductionAad introduction
Aad introduction
 
Algorithms : Introduction and Analysis
Algorithms : Introduction and AnalysisAlgorithms : Introduction and Analysis
Algorithms : Introduction and Analysis
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
Algorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structureAlgorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structure
 
Data Structures Notes
Data Structures NotesData Structures Notes
Data Structures Notes
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
Analysis algorithm
Analysis algorithmAnalysis algorithm
Analysis algorithm
 
algocomplexity cost effective tradeoff in
algocomplexity cost effective tradeoff inalgocomplexity cost effective tradeoff in
algocomplexity cost effective tradeoff in
 
chapter 1
chapter 1chapter 1
chapter 1
 
presentationfinal-090714235255-phpapp01 (1) (2).pptx
presentationfinal-090714235255-phpapp01 (1) (2).pptxpresentationfinal-090714235255-phpapp01 (1) (2).pptx
presentationfinal-090714235255-phpapp01 (1) (2).pptx
 
A Heterogeneous Static Hierarchical Expected Completion Time Based Scheduling...
A Heterogeneous Static Hierarchical Expected Completion Time Based Scheduling...A Heterogeneous Static Hierarchical Expected Completion Time Based Scheduling...
A Heterogeneous Static Hierarchical Expected Completion Time Based Scheduling...
 
Asymptotic Analysis in Data Structure using C
Asymptotic Analysis in Data Structure using CAsymptotic Analysis in Data Structure using C
Asymptotic Analysis in Data Structure using C
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
 
CCS 3102 Lecture 3_ Complexity theory.pdf
CCS 3102 Lecture 3_ Complexity theory.pdfCCS 3102 Lecture 3_ Complexity theory.pdf
CCS 3102 Lecture 3_ Complexity theory.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 ...
 
Unit ii algorithm
Unit   ii algorithmUnit   ii algorithm
Unit ii algorithm
 

Recently uploaded

一比一定制加州大学欧文分校毕业证学位证书
一比一定制加州大学欧文分校毕业证学位证书一比一定制加州大学欧文分校毕业证学位证书
一比一定制加州大学欧文分校毕业证学位证书A
 
一比一定制(Temasek毕业证书)新加坡淡马锡理工学院毕业证学位证书
一比一定制(Temasek毕业证书)新加坡淡马锡理工学院毕业证学位证书一比一定制(Temasek毕业证书)新加坡淡马锡理工学院毕业证学位证书
一比一定制(Temasek毕业证书)新加坡淡马锡理工学院毕业证学位证书B
 
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样Fi
 
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0APNIC
 
一比一定制(USC毕业证书)美国南加州大学毕业证学位证书
一比一定制(USC毕业证书)美国南加州大学毕业证学位证书一比一定制(USC毕业证书)美国南加州大学毕业证学位证书
一比一定制(USC毕业证书)美国南加州大学毕业证学位证书Fir
 
一比一原版英国格林多大学毕业证如何办理
一比一原版英国格林多大学毕业证如何办理一比一原版英国格林多大学毕业证如何办理
一比一原版英国格林多大学毕业证如何办理AS
 
一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书A
 
原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样AS
 
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样AS
 
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书AS
 
Dan Quinn Commanders Feather Dad Hat Hoodie
Dan Quinn Commanders Feather Dad Hat HoodieDan Quinn Commanders Feather Dad Hat Hoodie
Dan Quinn Commanders Feather Dad Hat Hoodierahman018755
 
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowHUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowIdeoholics
 
一比一原版(毕业证书)新加坡南洋理工学院毕业证原件一模一样
一比一原版(毕业证书)新加坡南洋理工学院毕业证原件一模一样一比一原版(毕业证书)新加坡南洋理工学院毕业证原件一模一样
一比一原版(毕业证书)新加坡南洋理工学院毕业证原件一模一样AS
 
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样Fi
 
一比一原版英国创意艺术大学毕业证如何办理
一比一原版英国创意艺术大学毕业证如何办理一比一原版英国创意艺术大学毕业证如何办理
一比一原版英国创意艺术大学毕业证如何办理AS
 
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书c6eb683559b3
 
Free on Wednesdays T Shirts Free on Wednesdays Sweatshirts
Free on Wednesdays T Shirts Free on Wednesdays SweatshirtsFree on Wednesdays T Shirts Free on Wednesdays Sweatshirts
Free on Wednesdays T Shirts Free on Wednesdays Sweatshirtsrahman018755
 
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理apekaom
 
Loker Pemandu Lagu LC Semarang 085746015303
Loker Pemandu Lagu LC Semarang 085746015303Loker Pemandu Lagu LC Semarang 085746015303
Loker Pemandu Lagu LC Semarang 085746015303Dewi Agency
 
一比一原版布兰迪斯大学毕业证如何办理
一比一原版布兰迪斯大学毕业证如何办理一比一原版布兰迪斯大学毕业证如何办理
一比一原版布兰迪斯大学毕业证如何办理A
 

Recently uploaded (20)

一比一定制加州大学欧文分校毕业证学位证书
一比一定制加州大学欧文分校毕业证学位证书一比一定制加州大学欧文分校毕业证学位证书
一比一定制加州大学欧文分校毕业证学位证书
 
一比一定制(Temasek毕业证书)新加坡淡马锡理工学院毕业证学位证书
一比一定制(Temasek毕业证书)新加坡淡马锡理工学院毕业证学位证书一比一定制(Temasek毕业证书)新加坡淡马锡理工学院毕业证学位证书
一比一定制(Temasek毕业证书)新加坡淡马锡理工学院毕业证学位证书
 
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
 
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
APNIC Policy Roundup presented by Sunny Chendi at TWNOG 5.0
 
一比一定制(USC毕业证书)美国南加州大学毕业证学位证书
一比一定制(USC毕业证书)美国南加州大学毕业证学位证书一比一定制(USC毕业证书)美国南加州大学毕业证学位证书
一比一定制(USC毕业证书)美国南加州大学毕业证学位证书
 
一比一原版英国格林多大学毕业证如何办理
一比一原版英国格林多大学毕业证如何办理一比一原版英国格林多大学毕业证如何办理
一比一原版英国格林多大学毕业证如何办理
 
一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书
 
原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样
 
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
 
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
 
Dan Quinn Commanders Feather Dad Hat Hoodie
Dan Quinn Commanders Feather Dad Hat HoodieDan Quinn Commanders Feather Dad Hat Hoodie
Dan Quinn Commanders Feather Dad Hat Hoodie
 
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowHUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
 
一比一原版(毕业证书)新加坡南洋理工学院毕业证原件一模一样
一比一原版(毕业证书)新加坡南洋理工学院毕业证原件一模一样一比一原版(毕业证书)新加坡南洋理工学院毕业证原件一模一样
一比一原版(毕业证书)新加坡南洋理工学院毕业证原件一模一样
 
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
 
一比一原版英国创意艺术大学毕业证如何办理
一比一原版英国创意艺术大学毕业证如何办理一比一原版英国创意艺术大学毕业证如何办理
一比一原版英国创意艺术大学毕业证如何办理
 
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
 
Free on Wednesdays T Shirts Free on Wednesdays Sweatshirts
Free on Wednesdays T Shirts Free on Wednesdays SweatshirtsFree on Wednesdays T Shirts Free on Wednesdays Sweatshirts
Free on Wednesdays T Shirts Free on Wednesdays Sweatshirts
 
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
 
Loker Pemandu Lagu LC Semarang 085746015303
Loker Pemandu Lagu LC Semarang 085746015303Loker Pemandu Lagu LC Semarang 085746015303
Loker Pemandu Lagu LC Semarang 085746015303
 
一比一原版布兰迪斯大学毕业证如何办理
一比一原版布兰迪斯大学毕业证如何办理一比一原版布兰迪斯大学毕业证如何办理
一比一原版布兰迪斯大学毕业证如何办理
 

DAAMOD12hjsfgi haFIUAFKJNASFQF MNDAF.pdf

  • 1. Program: BE (Computer Engineering & Information Technology) Class: TE Course: Design and Analysis of Algorithm Unit 01: Introduction to DAA Lecture 02: Analysis of Algorithm and Asymptotic Notations
  • 2. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Analysis of Algorithm  In designing of Algorithm, complexity analysis of an algorithm is an essential aspect.  Mainly, algorithmic complexity is concerned about its performance, how fast or slow it works.  There are many criteria upon which the performance of an Algorithm can be decided like,  Does it do what we want it to do?  Does it work correctly according to the original specifications of the task?  Is there documentation that describes how to use it & how it works?  Are procedures creates in such a way that they perform logical sub functions?  Is the code readable? 04
  • 3. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Analysis of Algorithm  These criteria are all vitally important when it comes to write or design the software’s for a large system.  But the most important factors for measure the performance of an Algorithm by computing two factors.,  Amount of time required by an Algorithm to execute i. e. Time Complexity.  Amount of space required by an Algorithm i. e. Space Complexity. 05
  • 4. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Analysis of Algorithm 1. Time Complexity  The time complexity of an Algorithm is the amount of computer time required by an Algorithm to run to completion.  It is difficult to compute the time complexity in terms of physical clocked time.  For instance in multiuser system, executing time depends on many factors such as,  System Load.  Number of other programs running.  Instruction set used.  Speed of underlying hardware.  The time complexity is therefore given of frequency count. 06
  • 5. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Analysis of Algorithm 1. Time Complexity  Frequency count is a count denoting number of time of execution of statement.  If the input size is longer, then usually Algorithm runs for a longer time.  Time Complexity denoted by, T(n) = Cop * C(n) Where, T(n) = Running Time of basic operation. Cop = Time taken by the basic operation to execute. C(n) = Number of times the operation needs to be executed. 07
  • 6. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Analysis of Algorithm 2. Space Complexity  The space complexity of an Algorithm is the amount memory required by an Algorithm to run.  It’s a function describing the amount of memory an algorithm takes in terms of the size of input to the algorithm. We often speak of "extra" memory needed, not counting the memory needed to store the input itself.  Space complexity is sometimes ignored because the space used is minimal and/or obvious, however sometimes it becomes as important an issue as time.  Space complexity depends upon two factors,  Constant Characteristics.  Instance Characteristics. 08  Space Complexity denoted by, S(p) = C + Sp Where, S(p) = Space Complexity. C = Constant. Sp = space dependent upon instance characteristics.
  • 7. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Analysis of Algorithm Best Case, Worst Case, & Average Case Analysis Best Case  If an Algorithm takes minimum amount of time to run to completion for a specific set of input then it is called as Best Case Time complexity.  Best Case Time Complexity denoted as, Cbest = 1 Example: While searching a particular element by using sequential search we get the desired element at first place itself then it is the best case. 09
  • 8. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Analysis of Algorithm Best Case, Worst Case, & Average Case Analysis Worst Case  If an Algorithm takes maximum amount of time to run to completion for a specific set of input then it is called as Worst Case Time complexity.  Worst Case Time Complexity denoted as, Cworst = n Example: While searching an element by using liner searching methods if desired element is placed at the end of the list then we get the Worst Case Time Complexity. 10
  • 9. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Analysis of Algorithm Best Case, Worst Case, & Average Case Analysis Average Case  The Time Complexity for certain set of inputs is as a average same. Then for corresponding input such a time complexity is called Average Case Time Complexity.  For calculating Average Case Time Complexity we have to consider probability of getting success of the operation.  Any operation in the Algorithm is heavily dependent on input elements.  Thus computing Average Case Time Complexity is difficult than computing Worst Case & Best Case Time Complexity  Average Case Time Complexity denoted as, Cavg (n) = (n+1)/2 11
  • 10. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Asymptotic Notations  Execution time of an algorithm depends on the instruction set, processor speed, disk I/O speed, etc. Hence, it estimate the efficiency of an algorithm asymptotically.  To choose the best Algorithm, we need to check the efficiency of each Algorithm. The efficiency can be measured by computing Time Complexity of each Algorithm.  Asymptotic notation is a shorthand way to represent the Time Complexity.  Using the Asymptotic notations we can give Time Complexity as “Fastest Possible”, “Slowest Possible”, or Average Time”.  Following asymptotic notations are used to calculate the running time complexity of an algorithm. 1. Big Oh (O) 2. Omega (Ω) 3. Theta (θ) 12
  • 11. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Asymptotic Notations 1. Big Oh (O) : Asymptotic Lower Bound  It is a method of representing the upper bound of algorithm’s running time.  Big oh notation is used to find the longest amount of time taken by the Algorithm to complete.  Let f(n) & g(n) be two non-negative functions. Let n0 & constant C are two integers, such that n0 denotes some value of input & n > n0. Similarly C is some constant such that C > 0.  We can write, f(n) ≤ C * g(n)  Then f(n) is Big Oh of g(n). it is also denoted as f(n) € O(g(n)).  In other words f(n) is less than g(n), if g(n) is multiple of some constant C. 13
  • 12. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Asymptotic Notations 2. Omega (Ω)  It is used to represent the lower bound of Algorithm’s running time.  It also denotes the shortest amount of time taken by Algorithm.  A function f(n) is said to be in Ω(g(n)), if f(n) is bounded by some positive constant multiple of g(n) such that, f(n) ≥ C * g(n) for all n > n0  It is denoted as f(n) € Ω (g(n)). 14
  • 13. www.sandipuniversity.edu.in www.sandipfoundation.org Department of Computer Engineering & Information Technology, SITRC, Nashik Asymptotic Notations 3. Theta (θ)  It shows the running time is between upper bound and lower bound.  Let f(n) and g(n) be two non negative functions, there are two constants namely c1 and c2 such that, c2 g(n) ≤ f(n) ≤ c1 g(n)  It is denoted as f(n) € (g(n)). 15