SlideShare a Scribd company logo
Introduction to
Analysis & Design of Algorithm
Submitted by:
Prof. Bulbul Agrawal
Assistant Professor
Department of Computer Science & Engineering and Information Technology
Content
• Terminologies
• Course Objective
• Skeleton of the ADA
• Introduction to ADA
• Asymptotic Notations
• Algorithm Design Techniques
Terminologies:
• Algorithm Design:
Methods for designing efficient algorithms.
• Algorithm Analysis:
Analysis of resource usage of given algorithms. (Time & Space)
Why do we study this subject?
• Efficient algorithms lead to efficient programs.
• Efficient programs sell better.
• Efficient programs make better used of hardware.
• Programmers who write efficient programs are preferred.
Course Objective:
• The data structure includes analyzing various algorithms along with time and space
complexities. It also helps students to design new algorithms through mathematical
analysis and programming.
Skeleton of ADA:
ADA
Unit:1
Divide and
Conquer
Unit:2
Greedy
Strategy
Unit:3
Dynamic
Programming
Unit:4
Backtracking
and Branch &
Bound
Unit:5
Graphs and
Trees
Introduction:
• The set of rules that define how a particular problem can be solved in finite number of
steps is known as algorithm.
• An algorithm is a list of steps (Sequence of unambiguous instructions) for solving a
problem that transforms the input into the output.
Problem
Algorithm
Computer
Input Output
Designing of an algorithm:
Understand the problem
Decision making on:
Capabilities of computational devices
Algorithm Design Techniques
Data Structures
Specification of algorithms
Analysis of algorithm
Algorithm verification
Code the algorithm
Properties of an algorithm:
• An algorithm takes zero or more inputs.
• An algorithm results in one or more outputs.
• All operations can be carried out in a finite amount of time.
• An algorithm should be efficient and flexible.
• It should use less memory space as much as possible.
• An algorithm must terminate after a finite number of steps.
• Each step in the algorithm must be easily understood.
• An algorithm should be concise and compact to facilitate verification of their
correctness.
Two main tasks in the study of Algorithms:
• Algorithm Design
• Analysis of Algorithms
How to analyzed the algorithm?
Algorithm efficiency can be measured by two aspects;
Time Complexity: Given in terms of frequency count
• Instructions take time.
• How fast does the algorithm perform?
• What affects its runtime?
Space Complexity: Amount of memory required
• Data structure take space.
• What kind of data structure can be used?
• How does choice of data structure affect the runtime?
Asymptotic Notations:
 Given two algorithms for a task, how we find out which one is better?
1. It might be possible that for some inputs, first algorithm performs better than
the second. And for some inputs second performs better.
2. Or it might also be possible that for some inputs, first algorithm perform
better on one machine and the second works better on other machine for
some other inputs.
 So Asymptotic Notation is the big idea that handles above issues in analysing
algorithms. In Asymptotic Analysis, we evaluate the performance of an
algorithm in terms of input size.
 Using Asymptotic Analysis we can very well conclude the Best Case, Average
Case, and Worst Case scenario of an algorithm.
Asymptotic Notations:
• Asymptotic Notations are used to represent the complexity of an algorithm.
• Asymptotic Notations provides with a mechanism to calculate and represent
time and space complexity for any algorithm.
Order of Growth:
• Order of growth in algorithm means how the time for computation increase
when you increase the input size. It really matters when your input size is very
large.
Kind of Analysis:
Usually the time required by an algorithm falls under three types:
 Best Case: Minimum time required for algorithm execution
 Average Case: Average time required for algorithm execution
 Worst Case: Worst time required for algorithm execution
Following are the commonly used asymptotic notations to calculate the running
time complexity of an algorithm;
 O-Notation (Big-Oh Notation)
 Ω-Notation (Omega Notation)
 Θ-Notation (Theta Notation)
O-Notation (Big-Oh Notation):
• Big-O notation represents the upper bound of the running time of an algorithm.
Thus, it gives the worst-case complexity of an algorithm.
• Given two functions f(n) & g(n) for input n, we say f(n) is in O(g(n) ) iff there
exist positive constants c and n0 such that
f(n)  c g(n) for all n  n0
• Basically, we want to find a function g(n) that is
eventually always bigger than f(n).
• g(n) is an asymptotic upper bound for f(n).
Ω-Notation (Omega Notation):
• Omega notation represents the lower bound of the running time of an
algorithm. Thus, it provides the best case complexity of an algorithm.
• Given two functions f(n) & g(n) for input n, we say f(n) is in Ω(g(n) ) iff there
exist positive constants c and n0 such that
f(n)  c g(n) for all n  n0
• Basically, we want to find a function g(n) that is
eventually always smaller than f(n).
• g(n) is an asymptotic lower bound for f(n).
Θ-Notation (Theta Notation):
• Since it represents the upper and the lower bound of the running time of an
algorithm, it is used for analyzing the average-case complexity of an algorithm.
• Given two functions f(n) & g(n) for input n, we say f(n) is in Θ(g(n) ) iff there
exist positive constants C1 & C2 and n0 such that
C1 g(n)  f(n)  C2 g(n)
for all n  n0
• g(n) is an asymptotically tight bound for f(n).
Algorithm Design Strategies:
We can design an algorithm by choose the one of the following strategies:
1. Divide and Conquer
2. Greedy Algorithm
3. Dynamic programming
4. Backtracking
5. Branch and Bound
1. Divide & Conquer Strategy:
The algorithm which follows divide and conquer technique involves 3 steps:
1. Divide the original problem into a set of sub problems.
2. Conquer (or solve) every sub-problem individually, recursive.
3. Combine the solutions of these sub problems to get the solution of original
problem.
 Problems that follow divide and conquer strategy:
• Merge Sort
• Binary Search
• Strassen's Matrix Multiplication
2. Greedy Strategy:
• Greedy technique is used to solve an optimization problem. (Repeatedly do what is
best now)
• An Optimization problem is one in which, we are given a set of input values, which
are required to be either maximized or minimized (known as objective function) w.r.t.
some constraints or conditions.
• The greedy algorithm does not always guarantee the optimal solution but it generally
produces solutions that are very close in value to the optimal.
 Problems that follow greedy strategy:
• Fractional Knapsack Problem
• Minimum Spanning Tress
• Single Source Shortest Path Algorithm
• Job Sequencing With Deadline
3. Dynamic Programming:
• Dynamic programming is a technique that breaks the problems into sub-
problems, and saves the result for future purposes so that we do not need to
compute the result again.
• The subproblems are optimized to optimize the overall solution is known as
optimal substructure property.
Problems that follow dynamic strategy:
• 0/1 Knapsack
• Matrix Chain Multiplication
• Multistage Graph
4. Backtracking:
• Backtracking is an algorithmic technique for solving problems by trying to
build a solution incrementally, one piece at a time, removing those solutions
that fail to satisfy the constraints of the problem at any point
• Backtracking is not used for optimization. Backtracking basically means trying
all possible options. It is used when you have multiple solution and you want
all those solutions.
Problems that follow backtracking strategy:
• N-Queen’s Problems
• Graph Colouring
• Hamiltonian Cycle
5. Branch and Bound:
• It is similar to the backtracking since it also uses the state space tree. It is used
for solving the optimization problems and minimization problems.
• A branch and bound algorithm is an optimization technique to get an optimal
solution to the problem. It looks for the best solution for a given problem in the
entire space of the solution. The bounds in the function to be optimized are
merged with the value of the latest best solution.
Problem that follow branch and bound strategy:
• Travelling Salesman Problem
After completion the course, Students will
be able to:
• Determine the time and space complexity of simple algorithms.
• Use notations to give upper, lower, and tight bounds on time and space
complexity of algorithms.
• Practice the main algorithm design strategies of Brute Force, Divide and
Conquer, Greedy Methods, Dynamic Programming, Backtracking, and Branch
and Bound and implement examples of each.
• Implement the most common sorting and searching algorithms and perform
their complexity analysis.
• Solve problems using the fundamental graph algorithms.
• Evaluate, select and implement algorithms in programming context.
Reference Books:
• Coremen Thomas, Leiserson CE, Rivest RL; Introduction to Algorithms; PHI.
• Horowitz & Sahani; Analysis & Design of Algorithm
• Dasgupta; algorithms; TMH
• Ullmann; Analysis & Design of Algorithm
• Michael T Goodrich, Robarto Tamassia, Algorithm Design, Wiely India
Analysis and Design of Algorithms
Analysis and Design of Algorithms
Ad

More Related Content

What's hot (20)

Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
Muhammad Muzammal
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
Ritu Ranjan Shrivastwa
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
Protap Mondal
 
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
Saranya Natarajan
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
Rishabh Soni
 
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptUNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
racha49
 
Automata theory
Automata theoryAutomata theory
Automata theory
Pardeep Vats
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Nikhil Sharma
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
Dr Shashikant Athawale
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
Animesh Chaturvedi
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
swapnac12
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
sumitbardhan
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
Muhammed Afsal Villan
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
Riya Choudhary
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
Graph coloring using backtracking
Graph coloring using backtrackingGraph coloring using backtracking
Graph coloring using backtracking
shashidharPapishetty
 
Np hard
Np hardNp hard
Np hard
jesal_joshi
 
Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
Rajendra Dangwal
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
Fahim Ferdous
 
Big o notation
Big o notationBig o notation
Big o notation
hamza mushtaq
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
Ritu Ranjan Shrivastwa
 
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
Saranya Natarajan
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
Rishabh Soni
 
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptUNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
racha49
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Nikhil Sharma
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
Animesh Chaturvedi
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
swapnac12
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
sumitbardhan
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
Fahim Ferdous
 

Similar to Analysis and Design of Algorithms (20)

daa18d8d-d333-4398-94dd-a46802d88d79.pptx
daa18d8d-d333-4398-94dd-a46802d88d79.pptxdaa18d8d-d333-4398-94dd-a46802d88d79.pptx
daa18d8d-d333-4398-94dd-a46802d88d79.pptx
yvtinsane
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
RahikAhmed1
 
ADA_Module 1_MN.pptx- Analysis and design of Algorithms
ADA_Module 1_MN.pptx- Analysis and design of AlgorithmsADA_Module 1_MN.pptx- Analysis and design of Algorithms
ADA_Module 1_MN.pptx- Analysis and design of Algorithms
madhu614742
 
Introduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer ScienceIntroduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer Science
tissandavid
 
introduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer scienceintroduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer science
tissandavid
 
DAA 1 ppt.pptx
DAA 1 ppt.pptxDAA 1 ppt.pptx
DAA 1 ppt.pptx
RAJESH S
 
DAA ppt.pptx
DAA ppt.pptxDAA ppt.pptx
DAA ppt.pptx
RAJESH S
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptx
satvikkushwaha1
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
jinkhatima
 
Design and Analysis of Algorithm for II year Computer science and Engineering...
Design and Analysis of Algorithm for II year Computer science and Engineering...Design and Analysis of Algorithm for II year Computer science and Engineering...
Design and Analysis of Algorithm for II year Computer science and Engineering...
Kalpana Devi M
 
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.pptChapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Tekle12
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.ppt
Tekle12
 
Algorithm and C code related to data structure
Algorithm and C code related to data structureAlgorithm and C code related to data structure
Algorithm and C code related to data structure
Self-Employed
 
Python algorithm
Python algorithmPython algorithm
Python algorithm
Prof. Dr. K. Adisesha
 
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPTANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
AIET
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
Koteswari Kasireddy
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
Koteswari Kasireddy
 
problem solving and algorithm development
problem solving and algorithm developmentproblem solving and algorithm development
problem solving and algorithm development
jessicajames100
 
1_Introduction.pptx
1_Introduction.pptx1_Introduction.pptx
1_Introduction.pptx
ASVKVinayak
 
Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity Calculation
Akhil Kaushik
 
daa18d8d-d333-4398-94dd-a46802d88d79.pptx
daa18d8d-d333-4398-94dd-a46802d88d79.pptxdaa18d8d-d333-4398-94dd-a46802d88d79.pptx
daa18d8d-d333-4398-94dd-a46802d88d79.pptx
yvtinsane
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
RahikAhmed1
 
ADA_Module 1_MN.pptx- Analysis and design of Algorithms
ADA_Module 1_MN.pptx- Analysis and design of AlgorithmsADA_Module 1_MN.pptx- Analysis and design of Algorithms
ADA_Module 1_MN.pptx- Analysis and design of Algorithms
madhu614742
 
Introduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer ScienceIntroduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer Science
tissandavid
 
introduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer scienceintroduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer science
tissandavid
 
DAA 1 ppt.pptx
DAA 1 ppt.pptxDAA 1 ppt.pptx
DAA 1 ppt.pptx
RAJESH S
 
DAA ppt.pptx
DAA ppt.pptxDAA ppt.pptx
DAA ppt.pptx
RAJESH S
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptx
satvikkushwaha1
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
jinkhatima
 
Design and Analysis of Algorithm for II year Computer science and Engineering...
Design and Analysis of Algorithm for II year Computer science and Engineering...Design and Analysis of Algorithm for II year Computer science and Engineering...
Design and Analysis of Algorithm for II year Computer science and Engineering...
Kalpana Devi M
 
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.pptChapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Tekle12
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.ppt
Tekle12
 
Algorithm and C code related to data structure
Algorithm and C code related to data structureAlgorithm and C code related to data structure
Algorithm and C code related to data structure
Self-Employed
 
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPTANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
AIET
 
problem solving and algorithm development
problem solving and algorithm developmentproblem solving and algorithm development
problem solving and algorithm development
jessicajames100
 
1_Introduction.pptx
1_Introduction.pptx1_Introduction.pptx
1_Introduction.pptx
ASVKVinayak
 
Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity Calculation
Akhil Kaushik
 
Ad

More from Bulbul Agrawal (7)

Introduction to Data Structures and their importance
Introduction to Data Structures and their importanceIntroduction to Data Structures and their importance
Introduction to Data Structures and their importance
Bulbul Agrawal
 
Software Metrics, Project Management and Estimation
Software Metrics, Project Management and EstimationSoftware Metrics, Project Management and Estimation
Software Metrics, Project Management and Estimation
Bulbul Agrawal
 
Age Estimation And Gender Prediction Using Convolutional Neural Network.pptx
Age Estimation And Gender Prediction Using Convolutional Neural Network.pptxAge Estimation And Gender Prediction Using Convolutional Neural Network.pptx
Age Estimation And Gender Prediction Using Convolutional Neural Network.pptx
Bulbul Agrawal
 
Techniques for creating an effective resume
Techniques for creating an effective resumeTechniques for creating an effective resume
Techniques for creating an effective resume
Bulbul Agrawal
 
Standard Statistical Feature analysis of Image Features for Facial Images usi...
Standard Statistical Feature analysis of Image Features for Facial Images usi...Standard Statistical Feature analysis of Image Features for Facial Images usi...
Standard Statistical Feature analysis of Image Features for Facial Images usi...
Bulbul Agrawal
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
Bulbul Agrawal
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
Bulbul Agrawal
 
Introduction to Data Structures and their importance
Introduction to Data Structures and their importanceIntroduction to Data Structures and their importance
Introduction to Data Structures and their importance
Bulbul Agrawal
 
Software Metrics, Project Management and Estimation
Software Metrics, Project Management and EstimationSoftware Metrics, Project Management and Estimation
Software Metrics, Project Management and Estimation
Bulbul Agrawal
 
Age Estimation And Gender Prediction Using Convolutional Neural Network.pptx
Age Estimation And Gender Prediction Using Convolutional Neural Network.pptxAge Estimation And Gender Prediction Using Convolutional Neural Network.pptx
Age Estimation And Gender Prediction Using Convolutional Neural Network.pptx
Bulbul Agrawal
 
Techniques for creating an effective resume
Techniques for creating an effective resumeTechniques for creating an effective resume
Techniques for creating an effective resume
Bulbul Agrawal
 
Standard Statistical Feature analysis of Image Features for Facial Images usi...
Standard Statistical Feature analysis of Image Features for Facial Images usi...Standard Statistical Feature analysis of Image Features for Facial Images usi...
Standard Statistical Feature analysis of Image Features for Facial Images usi...
Bulbul Agrawal
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
Bulbul Agrawal
 
Ad

Recently uploaded (20)

Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Journal of Soft Computing in Civil Engineering
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.
anuragmk56
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.
anuragmk56
 

Analysis and Design of Algorithms

  • 1. Introduction to Analysis & Design of Algorithm Submitted by: Prof. Bulbul Agrawal Assistant Professor Department of Computer Science & Engineering and Information Technology
  • 2. Content • Terminologies • Course Objective • Skeleton of the ADA • Introduction to ADA • Asymptotic Notations • Algorithm Design Techniques
  • 3. Terminologies: • Algorithm Design: Methods for designing efficient algorithms. • Algorithm Analysis: Analysis of resource usage of given algorithms. (Time & Space)
  • 4. Why do we study this subject? • Efficient algorithms lead to efficient programs. • Efficient programs sell better. • Efficient programs make better used of hardware. • Programmers who write efficient programs are preferred.
  • 5. Course Objective: • The data structure includes analyzing various algorithms along with time and space complexities. It also helps students to design new algorithms through mathematical analysis and programming.
  • 6. Skeleton of ADA: ADA Unit:1 Divide and Conquer Unit:2 Greedy Strategy Unit:3 Dynamic Programming Unit:4 Backtracking and Branch & Bound Unit:5 Graphs and Trees
  • 7. Introduction: • The set of rules that define how a particular problem can be solved in finite number of steps is known as algorithm. • An algorithm is a list of steps (Sequence of unambiguous instructions) for solving a problem that transforms the input into the output. Problem Algorithm Computer Input Output
  • 8. Designing of an algorithm: Understand the problem Decision making on: Capabilities of computational devices Algorithm Design Techniques Data Structures Specification of algorithms Analysis of algorithm Algorithm verification Code the algorithm
  • 9. Properties of an algorithm: • An algorithm takes zero or more inputs. • An algorithm results in one or more outputs. • All operations can be carried out in a finite amount of time. • An algorithm should be efficient and flexible. • It should use less memory space as much as possible. • An algorithm must terminate after a finite number of steps. • Each step in the algorithm must be easily understood. • An algorithm should be concise and compact to facilitate verification of their correctness.
  • 10. Two main tasks in the study of Algorithms: • Algorithm Design • Analysis of Algorithms
  • 11. How to analyzed the algorithm? Algorithm efficiency can be measured by two aspects; Time Complexity: Given in terms of frequency count • Instructions take time. • How fast does the algorithm perform? • What affects its runtime? Space Complexity: Amount of memory required • Data structure take space. • What kind of data structure can be used? • How does choice of data structure affect the runtime?
  • 12. Asymptotic Notations:  Given two algorithms for a task, how we find out which one is better? 1. It might be possible that for some inputs, first algorithm performs better than the second. And for some inputs second performs better. 2. Or it might also be possible that for some inputs, first algorithm perform better on one machine and the second works better on other machine for some other inputs.  So Asymptotic Notation is the big idea that handles above issues in analysing algorithms. In Asymptotic Analysis, we evaluate the performance of an algorithm in terms of input size.  Using Asymptotic Analysis we can very well conclude the Best Case, Average Case, and Worst Case scenario of an algorithm.
  • 13. Asymptotic Notations: • Asymptotic Notations are used to represent the complexity of an algorithm. • Asymptotic Notations provides with a mechanism to calculate and represent time and space complexity for any algorithm. Order of Growth: • Order of growth in algorithm means how the time for computation increase when you increase the input size. It really matters when your input size is very large.
  • 14. Kind of Analysis: Usually the time required by an algorithm falls under three types:  Best Case: Minimum time required for algorithm execution  Average Case: Average time required for algorithm execution  Worst Case: Worst time required for algorithm execution Following are the commonly used asymptotic notations to calculate the running time complexity of an algorithm;  O-Notation (Big-Oh Notation)  Ω-Notation (Omega Notation)  Θ-Notation (Theta Notation)
  • 15. O-Notation (Big-Oh Notation): • Big-O notation represents the upper bound of the running time of an algorithm. Thus, it gives the worst-case complexity of an algorithm. • Given two functions f(n) & g(n) for input n, we say f(n) is in O(g(n) ) iff there exist positive constants c and n0 such that f(n)  c g(n) for all n  n0 • Basically, we want to find a function g(n) that is eventually always bigger than f(n). • g(n) is an asymptotic upper bound for f(n).
  • 16. Ω-Notation (Omega Notation): • Omega notation represents the lower bound of the running time of an algorithm. Thus, it provides the best case complexity of an algorithm. • Given two functions f(n) & g(n) for input n, we say f(n) is in Ω(g(n) ) iff there exist positive constants c and n0 such that f(n)  c g(n) for all n  n0 • Basically, we want to find a function g(n) that is eventually always smaller than f(n). • g(n) is an asymptotic lower bound for f(n).
  • 17. Θ-Notation (Theta Notation): • Since it represents the upper and the lower bound of the running time of an algorithm, it is used for analyzing the average-case complexity of an algorithm. • Given two functions f(n) & g(n) for input n, we say f(n) is in Θ(g(n) ) iff there exist positive constants C1 & C2 and n0 such that C1 g(n)  f(n)  C2 g(n) for all n  n0 • g(n) is an asymptotically tight bound for f(n).
  • 18. Algorithm Design Strategies: We can design an algorithm by choose the one of the following strategies: 1. Divide and Conquer 2. Greedy Algorithm 3. Dynamic programming 4. Backtracking 5. Branch and Bound
  • 19. 1. Divide & Conquer Strategy: The algorithm which follows divide and conquer technique involves 3 steps: 1. Divide the original problem into a set of sub problems. 2. Conquer (or solve) every sub-problem individually, recursive. 3. Combine the solutions of these sub problems to get the solution of original problem.  Problems that follow divide and conquer strategy: • Merge Sort • Binary Search • Strassen's Matrix Multiplication
  • 20. 2. Greedy Strategy: • Greedy technique is used to solve an optimization problem. (Repeatedly do what is best now) • An Optimization problem is one in which, we are given a set of input values, which are required to be either maximized or minimized (known as objective function) w.r.t. some constraints or conditions. • The greedy algorithm does not always guarantee the optimal solution but it generally produces solutions that are very close in value to the optimal.  Problems that follow greedy strategy: • Fractional Knapsack Problem • Minimum Spanning Tress • Single Source Shortest Path Algorithm • Job Sequencing With Deadline
  • 21. 3. Dynamic Programming: • Dynamic programming is a technique that breaks the problems into sub- problems, and saves the result for future purposes so that we do not need to compute the result again. • The subproblems are optimized to optimize the overall solution is known as optimal substructure property. Problems that follow dynamic strategy: • 0/1 Knapsack • Matrix Chain Multiplication • Multistage Graph
  • 22. 4. Backtracking: • Backtracking is an algorithmic technique for solving problems by trying to build a solution incrementally, one piece at a time, removing those solutions that fail to satisfy the constraints of the problem at any point • Backtracking is not used for optimization. Backtracking basically means trying all possible options. It is used when you have multiple solution and you want all those solutions. Problems that follow backtracking strategy: • N-Queen’s Problems • Graph Colouring • Hamiltonian Cycle
  • 23. 5. Branch and Bound: • It is similar to the backtracking since it also uses the state space tree. It is used for solving the optimization problems and minimization problems. • A branch and bound algorithm is an optimization technique to get an optimal solution to the problem. It looks for the best solution for a given problem in the entire space of the solution. The bounds in the function to be optimized are merged with the value of the latest best solution. Problem that follow branch and bound strategy: • Travelling Salesman Problem
  • 24. After completion the course, Students will be able to: • Determine the time and space complexity of simple algorithms. • Use notations to give upper, lower, and tight bounds on time and space complexity of algorithms. • Practice the main algorithm design strategies of Brute Force, Divide and Conquer, Greedy Methods, Dynamic Programming, Backtracking, and Branch and Bound and implement examples of each. • Implement the most common sorting and searching algorithms and perform their complexity analysis. • Solve problems using the fundamental graph algorithms. • Evaluate, select and implement algorithms in programming context.
  • 25. Reference Books: • Coremen Thomas, Leiserson CE, Rivest RL; Introduction to Algorithms; PHI. • Horowitz & Sahani; Analysis & Design of Algorithm • Dasgupta; algorithms; TMH • Ullmann; Analysis & Design of Algorithm • Michael T Goodrich, Robarto Tamassia, Algorithm Design, Wiely India