SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
Lecture 2 : Role of Algorithms in
Computing
Jayavignesh T
Asst Professor
SENSE
What is an Algorithm?
• An algorithm is a set of rules for carrying out calculation
either by hand or on a machine.
• An algorithm is a finite step-by-step procedure to
achieve a required result.
• An algorithm is a sequence of computational steps that
transform the input into the output.
• An algorithm is a sequence of operations performed on
data that have to be organized in data structures.
• An algorithm is an abstraction of a program to be
executed on a physical machine (model of
Computation).
What is an Algorithm contd..?
• An algorithm is a sequence of unambiguous
instructions for solving a problem,
– i.e., for obtaining a required output for any
legitimate input in a finite amount of time
Requirements
• Recipe, process, method, technique, procedure, routine,… with
following requirements:
1. Finiteness
– terminates after a finite number of steps
2. Definiteness
– rigorously and unambiguously specified
3. Input
– valid inputs are clearly specified
4. Output
– can be proved to produce the correct output given a valid
input
5. Effectiveness
– steps are sufficiently simple and basic
Design and Analysis
• Algorithmic is a branch of computer science that
consists of designing and analyzing computer
algorithms
• The “design” pertain to
– The description of algorithm at an abstract level
by means of a pseudo language, and
– Proof of correctness that is, the algorithm solves
the given problem in all cases.
• The “analysis” deals with performance
evaluation(complexity analysis).
Design and Analysis
• It is not depended on programming language,
machine.
• Are mathematical entities, which can be thought of
as running on some sort of idealized computer with
an infinite random access memory
• Algorithm design is all about the mathematical
theory behind the design of good programs.
Why Analyze?
• Why analyze algorithms?
– Evaluate Algorithm performance
– Compare Different Algorithms
• Analyze what about them?
– Running time, Memory usage, Solution quality
– Worst-case and “typical” case
• Computational complexity
– Understanding the intrinsic difficulty of computational
problems – Classifying problems according to difficulty
– Algorithms provide upper bound to show problem is
hard, must show that any algorithm to solve it requires at
least a given amount of resources
Algorithm Problem solving
Understand the problem
Decision Making
Design an Algorithm
Prove Correctness
Analyze Algorithm
Code the Algorithm
Understand the problem
• Necessary Inputs to solve the
problem?
• Input – Instances
• Decide range of inputs
• To Fix Boundary values
• Work correctly for all Valid inputs
Decision Making
• Analyze the required inputs and decide on
– Computational Means
– Exact vs Approximate Solving
– Data Structures
– Algorithm Design Technique
 Computational Means
 Computational capability of running devices
 Sequential Algorithm ( Random Access Machine RAM)
 Parallel Algorithm (Piece executed on multiple processing
devices and put back together to get correct result)
 Proper choice of Computational device (Space/Time
efficient)
Decision Making contd..
• Exact vs Approximate Solving
• Exact Algorithm
– Problem needs to be solved exactly or correctly
• Approximation Algorithm
– Solve a complex problem, we will not get exact
solution
– Ex : Travelling salesman problem
• Data Structures
– Algorithm + Data Structures – Programming Language
– Proper Choice of Data Structures required before
designing actual algorithm
Algorithm Design Technique
• Strategy or Paradigm
– General approach to solve program
algorithmically
– Different problems from Different areas of
computing
• Brute Force :
– Straight forward technique with naïve approach
• Divide and Conquer :
– Problem is divided into smaller instances
Algorithm Design Technique contd..
• Decrease and Conquer :
– Instance size is decreased to solve the problem
• Transform and Conquer :
– Instance is modified and then solved
• Dynamic Programming :
– Results of smaller, reoccurring instances are
obtained to solve problem
• Greedy Technique :
– Solve the problem by making locally optimal
decisions
Specification of Algorithm
• Natural Language
– Drawback : Specification by this means not clear
• Pseudo Code
– Mixture of Natural Language + Programming constructs
ALGORITHM Sum(a,b)
// Problem Description : This algorithm performs addition of two
numbers
// Input : Two integers a and b
// Output : Addition of two integers
c a + b
return c
• Flow Chart
– Using Geometric Shapes containing descriptions of algorithm’s steps.
Proving Algorithm’s Correctness
• Prove algorithm yields required results
• For Every Legitimate Input in finite amount of
time
• If one instance of valid input, the algorithm
performs incorrectly !!
– Ex : Mathematical Induction
Analysis of Algorithm
• Time Efficiency
– Indicates how fast algorithm runs
• Space Efficiency
– How much Extra memory the algorithm needs to
complete its execution
• Simplicity
– Generating Sequence of instructions which are easy to
understand
• Generality
– Range of inputs it can accept
– Generality of problem which algorithm can solve
Coding an Algorithm
• Implementation of algorithm done by
suitable programming language
– C
– C++
– Java,
– Verilog etc etc…
Problem Types to solve
• Sorting Algorithms
–Arranging elements in increasing
(ascending) or decreasing (descending)
order
–Numbers, Characters, Strings
–Sorting makes easier to search elements
–Ex : Dictionary, Telephone books, Class
lists, Employee database etc..
Problem Types to solve
• Sorting Algorithms
–Properties
• Stable Property
–Preserves the relative order of any two
equal elements. Position i , j where i < j ,
sorted list i’ and j’ such that i’ < j’
• In Place Property
–Does not require extra memory, except for
possibly a few memory unit
Searching
• To find the desired element from the list
• Element to be Searched – Search Key
• Sequential Search
• Binary Search etc.
• Some Search algorithms work faster than
others but
– Requires more memory
– Works only in sorted arrays etc..
Linear Search Algorithm
• Input: An array of n numbers and an element which is required to
be searched in the given list
• Output: Number exists in the list or not.
Algorithm:
1. Input the size of list i.e. n
2. Read the n elements of array A
3. Input the item/element to be searched in the given list.
4. for each element in the array i=1 to n
5. if A[i]==item
6. Search successful, return
7. if i==n+1
8. Search unsuccessful.
9. Stop
Graph Problems
• Collection of points called vertices
• Some are connected by line segments – edges
• Graph traversal algorithms, shortest path
algorithms etc…
• String Processing
– String – sequence of characters
– Text Strings = Letters, numbers, special
characters, bit strings (0 & 1)
Combinatorial Problems
• Computing Permutations and combinations
• Complex computing due to
– As problem size grows the combinatorial objects
grow rapidly and reach to huge value
– No algorithm available which solves these
problems in finite amount of time.
– Many fall under unsolvable problems
Geometric Problems
• Deal with geometric objects such as
points, lines and polygons
• Applications in Computer Graphics,
Robotics and topography
Time Complexity
• Amount of computer time required by an algorithm
to run on completion
• Difficult to compute time complexity in terms of
physically clocked time.
• Drawbacks of measuring running time in-terms of
seconds, millisecond etc are
– Dependence of speed of a underlying hardware
– Number of other programs running (System load)
– Dependence of compiler used in generating
machine code
How to calculate running time then?
• Time complexity given in terms of FREQUENCY
COUNT
• Count denoting number of times of execution of
statement.
For (i=0; i <n;i++) { // St1 : 1, St 2 : n+1 , St 3 : n times
sum = sum + a[i]; // n times
}
3n + 2 ; O(n) neglecting constants and lower order terms
How to calculate running time then?
for (i=0; i < n ; i ++) // 1 ; n+1 ; n times
{
for (j=0; j < n ; j ++) // n ; n(n+1) ; n(n)
{
c[i][j] = a[i][j] + b[i][j];
}
}
3n2+4n+ 2 = O(n2)
How to calculate running time then?
• All Algorithms run longer on larger inputs
• Algorithm’s efficiency - f(n)
• Identify the most important operations of the
algorithm – BASIC Operation
• Basic operation – contributing to most of total
running time
• Compute the number of times basic operation is
executed (mostly in inner loop)
Ex : Sorting Algorithms – Comparison (< >)
Matrix Multiplication, Polynomial evaluation – Arithmetic Operations ( *, +)
= (assignment), ==(equality) etc..
Order of Growth of Algorithm
• Measuring the performance of an algorithm
in relation with input size n
Rate of Growth of Algorithm as fn of i/p size
Efficiency comparisons

Mais conteúdo relacionado

Mais procurados

Time and space complexity
Time and space complexityTime and space complexity
Time and space complexityAnkit Katiyar
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of AlgorithmsSwapnil Agrawal
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxSyed Zaid Irshad
 
Heuristics Search Techniques in AI
Heuristics Search Techniques in AI Heuristics Search Techniques in AI
Heuristics Search Techniques in AI Bharat Bhushan
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysissumitbardhan
 
Knowledge representation in AI
Knowledge representation in AIKnowledge representation in AI
Knowledge representation in AIVishal Singh
 
Algorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IAlgorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IMohamed Loey
 
INTRODUCTION TO ALGORITHMS Third Edition
INTRODUCTION TO ALGORITHMS Third EditionINTRODUCTION TO ALGORITHMS Third Edition
INTRODUCTION TO ALGORITHMS Third EditionPHI Learning Pvt. Ltd.
 
Knowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceKnowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceRamla Sheikh
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventionssaranyatdr
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithmsDr Geetha Mohan
 
Basics & asymptotic notations
Basics & asymptotic notationsBasics & asymptotic notations
Basics & asymptotic notationsRajendran
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptarunsingh660
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithmMohd Arif
 

Mais procurados (20)

Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Chapter 5 Syntax Directed Translation
Chapter 5   Syntax Directed TranslationChapter 5   Syntax Directed Translation
Chapter 5 Syntax Directed Translation
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 
Sorting
SortingSorting
Sorting
 
Heuristics Search Techniques in AI
Heuristics Search Techniques in AI Heuristics Search Techniques in AI
Heuristics Search Techniques in AI
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 
Knowledge representation in AI
Knowledge representation in AIKnowledge representation in AI
Knowledge representation in AI
 
Algorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IAlgorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms I
 
INTRODUCTION TO ALGORITHMS Third Edition
INTRODUCTION TO ALGORITHMS Third EditionINTRODUCTION TO ALGORITHMS Third Edition
INTRODUCTION TO ALGORITHMS Third Edition
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Knowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceKnowledge representation In Artificial Intelligence
Knowledge representation In Artificial Intelligence
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
 
Basics & asymptotic notations
Basics & asymptotic notationsBasics & asymptotic notations
Basics & asymptotic notations
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.ppt
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithm
 

Destaque (20)

Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
#1 designandanalysis of algo
#1 designandanalysis of algo#1 designandanalysis of algo
#1 designandanalysis of algo
 
Slide1
Slide1Slide1
Slide1
 
Algorithms and Flowcharts
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and Flowcharts
 
Algorithm Design Presentation
Algorithm Design PresentationAlgorithm Design Presentation
Algorithm Design Presentation
 
Algorithm Design
Algorithm DesignAlgorithm Design
Algorithm Design
 
Our presentation on algorithm design
Our presentation on algorithm designOur presentation on algorithm design
Our presentation on algorithm design
 
2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Analysis algorithm introduction Lecture# 1
Analysis algorithm introduction Lecture# 1Analysis algorithm introduction Lecture# 1
Analysis algorithm introduction Lecture# 1
 
Daa
DaaDaa
Daa
 
WHAT IS COMPUTER SCIENCE?
WHAT IS COMPUTER SCIENCE?WHAT IS COMPUTER SCIENCE?
WHAT IS COMPUTER SCIENCE?
 
ATPG Methods and Algorithms
ATPG Methods and AlgorithmsATPG Methods and Algorithms
ATPG Methods and Algorithms
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Insertion sorting
Insertion sortingInsertion sorting
Insertion sorting
 

Semelhante a Lecture 2 role of algorithms in computing

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
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptxjinkhatima
 
DAA 1 ppt.pptx
DAA 1 ppt.pptxDAA 1 ppt.pptx
DAA 1 ppt.pptxRAJESH S
 
DAA ppt.pptx
DAA ppt.pptxDAA ppt.pptx
DAA ppt.pptxRAJESH S
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)jehan1987
 
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
 
Design & Analysis of Algorithm course .pptx
Design & Analysis of Algorithm course .pptxDesign & Analysis of Algorithm course .pptx
Design & Analysis of Algorithm course .pptxJeevaMCSEKIOT
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptTekle12
 
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.pptTekle12
 
Analysis of Algorithms
Analysis of AlgorithmsAnalysis of Algorithms
Analysis of AlgorithmsAmna Saeed
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesFellowBuddy.com
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptxRahikAhmed1
 
Unit II_Searching and Sorting Algorithms.ppt
Unit II_Searching and Sorting Algorithms.pptUnit II_Searching and Sorting Algorithms.ppt
Unit II_Searching and Sorting Algorithms.pptHODElex
 
Data structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfData structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfDukeCalvin
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptxShaistaRiaz4
 

Semelhante a Lecture 2 role of algorithms in computing (20)

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
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
 
DAA 1 ppt.pptx
DAA 1 ppt.pptxDAA 1 ppt.pptx
DAA 1 ppt.pptx
 
DAA ppt.pptx
DAA ppt.pptxDAA ppt.pptx
DAA ppt.pptx
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)
 
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...
 
Design & Analysis of Algorithm course .pptx
Design & Analysis of Algorithm course .pptxDesign & Analysis of Algorithm course .pptx
Design & Analysis of Algorithm course .pptx
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.ppt
 
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
 
Analysis of Algorithms
Analysis of AlgorithmsAnalysis of Algorithms
Analysis of Algorithms
 
Daa
DaaDaa
Daa
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture Notes
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
 
Unit II_Searching and Sorting Algorithms.ppt
Unit II_Searching and Sorting Algorithms.pptUnit II_Searching and Sorting Algorithms.ppt
Unit II_Searching and Sorting Algorithms.ppt
 
Unit 2 algorithm
Unit   2 algorithmUnit   2 algorithm
Unit 2 algorithm
 
Data structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfData structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdf
 
Algorithms.pdf
Algorithms.pdfAlgorithms.pdf
Algorithms.pdf
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
 
chapter 1
chapter 1chapter 1
chapter 1
 

Último

Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
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
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 
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
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 

Último (20)

Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
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
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
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...
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 

Lecture 2 role of algorithms in computing

  • 1. Lecture 2 : Role of Algorithms in Computing Jayavignesh T Asst Professor SENSE
  • 2. What is an Algorithm? • An algorithm is a set of rules for carrying out calculation either by hand or on a machine. • An algorithm is a finite step-by-step procedure to achieve a required result. • An algorithm is a sequence of computational steps that transform the input into the output. • An algorithm is a sequence of operations performed on data that have to be organized in data structures. • An algorithm is an abstraction of a program to be executed on a physical machine (model of Computation).
  • 3. What is an Algorithm contd..? • An algorithm is a sequence of unambiguous instructions for solving a problem, – i.e., for obtaining a required output for any legitimate input in a finite amount of time
  • 4. Requirements • Recipe, process, method, technique, procedure, routine,… with following requirements: 1. Finiteness – terminates after a finite number of steps 2. Definiteness – rigorously and unambiguously specified 3. Input – valid inputs are clearly specified 4. Output – can be proved to produce the correct output given a valid input 5. Effectiveness – steps are sufficiently simple and basic
  • 5. Design and Analysis • Algorithmic is a branch of computer science that consists of designing and analyzing computer algorithms • The “design” pertain to – The description of algorithm at an abstract level by means of a pseudo language, and – Proof of correctness that is, the algorithm solves the given problem in all cases. • The “analysis” deals with performance evaluation(complexity analysis).
  • 6. Design and Analysis • It is not depended on programming language, machine. • Are mathematical entities, which can be thought of as running on some sort of idealized computer with an infinite random access memory • Algorithm design is all about the mathematical theory behind the design of good programs.
  • 7. Why Analyze? • Why analyze algorithms? – Evaluate Algorithm performance – Compare Different Algorithms • Analyze what about them? – Running time, Memory usage, Solution quality – Worst-case and “typical” case • Computational complexity – Understanding the intrinsic difficulty of computational problems – Classifying problems according to difficulty – Algorithms provide upper bound to show problem is hard, must show that any algorithm to solve it requires at least a given amount of resources
  • 8. Algorithm Problem solving Understand the problem Decision Making Design an Algorithm Prove Correctness Analyze Algorithm Code the Algorithm
  • 9. Understand the problem • Necessary Inputs to solve the problem? • Input – Instances • Decide range of inputs • To Fix Boundary values • Work correctly for all Valid inputs
  • 10. Decision Making • Analyze the required inputs and decide on – Computational Means – Exact vs Approximate Solving – Data Structures – Algorithm Design Technique  Computational Means  Computational capability of running devices  Sequential Algorithm ( Random Access Machine RAM)  Parallel Algorithm (Piece executed on multiple processing devices and put back together to get correct result)  Proper choice of Computational device (Space/Time efficient)
  • 11. Decision Making contd.. • Exact vs Approximate Solving • Exact Algorithm – Problem needs to be solved exactly or correctly • Approximation Algorithm – Solve a complex problem, we will not get exact solution – Ex : Travelling salesman problem • Data Structures – Algorithm + Data Structures – Programming Language – Proper Choice of Data Structures required before designing actual algorithm
  • 12. Algorithm Design Technique • Strategy or Paradigm – General approach to solve program algorithmically – Different problems from Different areas of computing • Brute Force : – Straight forward technique with naïve approach • Divide and Conquer : – Problem is divided into smaller instances
  • 13. Algorithm Design Technique contd.. • Decrease and Conquer : – Instance size is decreased to solve the problem • Transform and Conquer : – Instance is modified and then solved • Dynamic Programming : – Results of smaller, reoccurring instances are obtained to solve problem • Greedy Technique : – Solve the problem by making locally optimal decisions
  • 14. Specification of Algorithm • Natural Language – Drawback : Specification by this means not clear • Pseudo Code – Mixture of Natural Language + Programming constructs ALGORITHM Sum(a,b) // Problem Description : This algorithm performs addition of two numbers // Input : Two integers a and b // Output : Addition of two integers c a + b return c • Flow Chart – Using Geometric Shapes containing descriptions of algorithm’s steps.
  • 15. Proving Algorithm’s Correctness • Prove algorithm yields required results • For Every Legitimate Input in finite amount of time • If one instance of valid input, the algorithm performs incorrectly !! – Ex : Mathematical Induction
  • 16. Analysis of Algorithm • Time Efficiency – Indicates how fast algorithm runs • Space Efficiency – How much Extra memory the algorithm needs to complete its execution • Simplicity – Generating Sequence of instructions which are easy to understand • Generality – Range of inputs it can accept – Generality of problem which algorithm can solve
  • 17. Coding an Algorithm • Implementation of algorithm done by suitable programming language – C – C++ – Java, – Verilog etc etc…
  • 18. Problem Types to solve • Sorting Algorithms –Arranging elements in increasing (ascending) or decreasing (descending) order –Numbers, Characters, Strings –Sorting makes easier to search elements –Ex : Dictionary, Telephone books, Class lists, Employee database etc..
  • 19. Problem Types to solve • Sorting Algorithms –Properties • Stable Property –Preserves the relative order of any two equal elements. Position i , j where i < j , sorted list i’ and j’ such that i’ < j’ • In Place Property –Does not require extra memory, except for possibly a few memory unit
  • 20. Searching • To find the desired element from the list • Element to be Searched – Search Key • Sequential Search • Binary Search etc. • Some Search algorithms work faster than others but – Requires more memory – Works only in sorted arrays etc..
  • 21. Linear Search Algorithm • Input: An array of n numbers and an element which is required to be searched in the given list • Output: Number exists in the list or not. Algorithm: 1. Input the size of list i.e. n 2. Read the n elements of array A 3. Input the item/element to be searched in the given list. 4. for each element in the array i=1 to n 5. if A[i]==item 6. Search successful, return 7. if i==n+1 8. Search unsuccessful. 9. Stop
  • 22. Graph Problems • Collection of points called vertices • Some are connected by line segments – edges • Graph traversal algorithms, shortest path algorithms etc… • String Processing – String – sequence of characters – Text Strings = Letters, numbers, special characters, bit strings (0 & 1)
  • 23. Combinatorial Problems • Computing Permutations and combinations • Complex computing due to – As problem size grows the combinatorial objects grow rapidly and reach to huge value – No algorithm available which solves these problems in finite amount of time. – Many fall under unsolvable problems
  • 24. Geometric Problems • Deal with geometric objects such as points, lines and polygons • Applications in Computer Graphics, Robotics and topography
  • 25. Time Complexity • Amount of computer time required by an algorithm to run on completion • Difficult to compute time complexity in terms of physically clocked time. • Drawbacks of measuring running time in-terms of seconds, millisecond etc are – Dependence of speed of a underlying hardware – Number of other programs running (System load) – Dependence of compiler used in generating machine code
  • 26. How to calculate running time then? • Time complexity given in terms of FREQUENCY COUNT • Count denoting number of times of execution of statement. For (i=0; i <n;i++) { // St1 : 1, St 2 : n+1 , St 3 : n times sum = sum + a[i]; // n times } 3n + 2 ; O(n) neglecting constants and lower order terms
  • 27. How to calculate running time then? for (i=0; i < n ; i ++) // 1 ; n+1 ; n times { for (j=0; j < n ; j ++) // n ; n(n+1) ; n(n) { c[i][j] = a[i][j] + b[i][j]; } } 3n2+4n+ 2 = O(n2)
  • 28. How to calculate running time then? • All Algorithms run longer on larger inputs • Algorithm’s efficiency - f(n) • Identify the most important operations of the algorithm – BASIC Operation • Basic operation – contributing to most of total running time • Compute the number of times basic operation is executed (mostly in inner loop) Ex : Sorting Algorithms – Comparison (< >) Matrix Multiplication, Polynomial evaluation – Arithmetic Operations ( *, +) = (assignment), ==(equality) etc..
  • 29.
  • 30. Order of Growth of Algorithm • Measuring the performance of an algorithm in relation with input size n
  • 31. Rate of Growth of Algorithm as fn of i/p size