SlideShare a Scribd company logo
1 of 21
1
Algorithms Analysis and Design
Lecture 1
Prepared by
ZARA
2
Major objective of this course is:
● Design and analysis of modern algorithms
● Different variants
● Accuracy
● Efficiency
● Comparing efficiencies
● Motivation thinking new algorithms
● Advanced designing techniques
● Real world problems will be taken as examples
● To create feelings about usefulness of this course
Objective of This Course
3
On successful completion, students will be able to
● Argue and prove correctness of algorithms
● Derive and solve mathematical models of problems
● Reasoning when an algorithm calls certain approach
● Analyze average and worst-case running times
● Integrating approaches in dynamic and greedy algos.
● Use of graph theory in problems solving
● Advanced topics such as
• Computational geometry, number theory etc.
● Several other algorithms such as
• String matching, NP completeness, approximate
algorithms etc.
Expected Results
4
Lecture No 1
Introduction
(What, Why and Where Algorithms . . .)
5
In this lecture we will cover the following
● What is Algorithm?
● Designing Techniques
● Model of Computation
● Algorithms as a technology
● Algorithms and other technologies
● Importance of algorithms
● Difference in Users and Developers
● Kinds of problems solved by algorithms
● Conclusion
Today Covered
6
● A computer algorithm is a detailed step-by-step method for
solving a problem by using a computer.
● An algorithm is a sequence of unambiguous instructions for
solving a problem in a finite amount of time.
● An Algorithm is well defined computational procedure that
takes some value, or set of values, as input and produces some
value, or set of values as output.
● More generally, an Algorithm is any well defined
computational procedure that takes collection of elements as
input and produces a collection of elements as output.
Algorithm
Input output
What is Algorithm?
7
● Most basic and popular algorithms are
■ Sorting algorithms
■ Searching algorithms
Which algorithm is best?
● Mainly, it depends upon various factors, for example in
case of sorting
■ The number of items to be sorted
■ The extent to which the items are already sorted
■ Possible restrictions on the item values
■ The kind of storage device to be used etc.
Popular Algorithms, Factors of Dependence
8
Problem
● The statement of the problem specifies, in general terms,
the desired input/output relationship.
Algorithm
● The algorithm describes a specific computational
procedure for achieving input/output relationship.
Example
● One might need to sort a sequence of numbers into non-
decreasing order.
Algorithms
● Various algorithms e.g. merge sort, quick sort, heap
sorts etc.
One Problem, Many Algorithms
9
● Brute Force
■ Straightforward, naive approach
■ Mostly expensive
● Divide-and-Conquer
■ Divide into smaller sub-problems
● Iterative Improvement
■ Improve one change at a time
● Decrease-and-Conquer
■ Decrease instance size
● Transform-and-Conquer
■ Modify problem first and then solve it
● Space and Time Tradeoffs
■ Use more space now to save time later
Important Designing Techniques
10
● Greedy Approach
■ Locally optimal decisions, can not change once made.
■ Efficient
■ Easy to implement
■ The solution is expected to be optimal
■ Every problem may not have greedy solution
● Dynamic programming
■ Decompose into sub-problems like divide and conquer
■ Sub-problems are dependant
■ Record results of smaller sub-problems
■ Re-use it for further occurrence
■ Mostly reduces complexity exponential to polynomial
Some of the Important Designing
Techniques
11
● Analysis
■ How does system work?
■ Breaking a system down to known components
■ How components (processes) relate to each other
■ Breaking a process down to known functions
● Synthesis
■ Building tools
■ Building functions with supporting tools
■ Composing functions to form a process
■ How components should be put together?
■ Final solution
Problem Solving Phases
12
● Problem
● Strategy
● Algorithm
■ Input
■ Output
■ Steps
● Analysis
■ Correctness
■ Time & Space
■ Optimality
● Implementation
● Verification
Problem Solving Process
13
● Design assumption
■ Level of abstraction which meets our requirements
■ Neither more nor less e.g. [0, 1] infinite continuous interval
● Analysis independent of the variations in
■ Machine
■ Operating system
■ Programming languages
■ Compiler etc.
● Low-level details will not be considered
● Our model will be an abstraction of a standard generic
single-processor machine, called a random access
machine or RAM.
Model of Computation (Assumptions)
14
● A RAM is assumed to be an idealized machine
■ Infinitely large random-access memory
■ Instructions execute sequentially
● Every instruction is in fact a basic operation on two values in
the machines memory which takes unit time.
● These might be characters or integers.
● Example of basic operations include
■ Assigning a value to a variable
■ Arithmetic operation (+, - , × , /) on integers
■ Performing any comparison e.g. a < b
■ Boolean operations
■ Accessing an element of an array.
Model of Computation (Assumptions)
15
● In theoretical analysis, computational complexity
■ Estimated in asymptotic sense, i.e.
■ Estimating for large inputs
● Big O, Omega, Theta etc. notations are used to compute
the complexity
● Asymptotic notations are used because different
implementations of algorithm may differ in efficiency
● Efficiencies of two given algorithm are related
■ By a constant multiplicative factor
■ Called hidden constant.
Model of Computation (Assumptions)
16
First poor assumption
● We assumed that each basic operation takes constant
time, i.e. model allows
■ Adding
■ Multiplying
■ Comparing etc.
two numbers of any length in constant time
● Addition of two numbers takes a unit time!
■ Not good because numbers may be arbitrarily
● Addition and multiplication both take unit time!
■ Again very bad assumption
Drawbacks in Model of Computation
17
Finally what about Our Model?
● But with all these weaknesses, our model is not so bad
because we have to give the
■ Comparison not the absolute analysis of any algorithm.
■ We have to deal with large inputs not with the small size
● Model seems to work well describing computational
power of modern nonparallel machines
Can we do Exact Measure of Efficiency ?
● Exact, not asymptotic, measure of efficiency can be
sometimes computed but it usually requires certain
assumptions concerning implementation
Model of Computation not so Bad
18
● Analysis will be performed with respect to this
computational model for comparison of algorithms
● We will give asymptotic analysis not detailed
comparison i.e. for large inputs
● We will use generic uniprocessor random-access
machine (RAM) in analysis
■ All memory equally expensive to access
■ No concurrent operations
■ All reasonable instructions take unit time, except, of
course, function calls
Summary : Computational Model
19
Algorithm As a Technology
● Efficiency:
● – Different algorithms solve the same problem often
differ noticeably in their efficiency
● – These differences can be much more significant
than difference due to hardware and software
● For example, insertion sort takes time roughly equal
to c1n 2 (c1 is constant) to sort n items. But, merge
sort takes time roughly equal to c2nlg n (c2 is
constant)
20
Algorithm As a Technology
● Algorithms as a technology • For example,
assume a faster computer A (1010
instructions/sec) running insertion sort against
a slower computer B (107 instructions/sec)
running merge sort. • Suppose that c1=2,
c2=50 and n = 107 . • the execution time of
computer A is 2(107 ) 2 / 1010 instructions/sec
= 20,000 seconds • the execution time of
computer B is 50 · 107 lg 107 / 107
instructions/sec = 1,163 seconds
21
● What, Why and Where Algorithms?
● Designing Techniques
● Problem solving Phases and Procedure
● Model of computations
■ Major assumptions at design and analysis level
■ Merits and demerits, justification of assumptions taken
● We proved that algorithm is a technology
● Compared algorithmic technology with others
● Discussed importance of algorithms
■ In almost all areas of computer science and engineering
■ Algorithms make difference in users and developers
Conclusion

More Related Content

What's hot

Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesFellowBuddy.com
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsKrishnan MuthuManickam
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IMohamed Loey
 
Aad introduction
Aad introductionAad introduction
Aad introductionMr SMAK
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithmsGanesh Solanke
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Dr. Pankaj Agarwal
 
Daa presentation 97
Daa presentation 97Daa presentation 97
Daa presentation 97Garima Verma
 
Analysis and design of algorithms part2
Analysis and design of algorithms part2Analysis and design of algorithms part2
Analysis and design of algorithms part2Deepak John
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithmsDr Geetha Mohan
 
Lecture 1 objective and course plan
Lecture 1   objective and course planLecture 1   objective and course plan
Lecture 1 objective and course planjayavignesh86
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysissumitbardhan
 
01 Analysis of Algorithms: Introduction
01 Analysis of Algorithms: Introduction01 Analysis of Algorithms: Introduction
01 Analysis of Algorithms: IntroductionAndres Mendez-Vazquez
 
Data Structures - Lecture 1 [introduction]
Data Structures - Lecture 1 [introduction]Data Structures - Lecture 1 [introduction]
Data Structures - Lecture 1 [introduction]Muhammad Hammad Waseem
 
Algorithm And analysis Lecture 03& 04-time complexity.
 Algorithm And analysis Lecture 03& 04-time complexity. Algorithm And analysis Lecture 03& 04-time complexity.
Algorithm And analysis Lecture 03& 04-time complexity.Tariq Khan
 

What's hot (20)

chapter 1
chapter 1chapter 1
chapter 1
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture Notes
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
 
Aad introduction
Aad introductionAad introduction
Aad introduction
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
 
Daa presentation 97
Daa presentation 97Daa presentation 97
Daa presentation 97
 
Analysis and design of algorithms part2
Analysis and design of algorithms part2Analysis and design of algorithms part2
Analysis and design of algorithms part2
 
Daa notes 2
Daa notes 2Daa notes 2
Daa notes 2
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
 
Lecture 1 objective and course plan
Lecture 1   objective and course planLecture 1   objective and course plan
Lecture 1 objective and course plan
 
Daa unit 5
Daa unit 5Daa unit 5
Daa unit 5
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 
01 Analysis of Algorithms: Introduction
01 Analysis of Algorithms: Introduction01 Analysis of Algorithms: Introduction
01 Analysis of Algorithms: Introduction
 
Data Structures - Lecture 1 [introduction]
Data Structures - Lecture 1 [introduction]Data Structures - Lecture 1 [introduction]
Data Structures - Lecture 1 [introduction]
 
Algorithm Introduction
Algorithm IntroductionAlgorithm Introduction
Algorithm Introduction
 
Algorithm And analysis Lecture 03& 04-time complexity.
 Algorithm And analysis Lecture 03& 04-time complexity. Algorithm And analysis Lecture 03& 04-time complexity.
Algorithm And analysis Lecture 03& 04-time complexity.
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 

Similar to Lecture01 algorithm analysis

Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptxjinkhatima
 
Design and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit oneDesign and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit onessuserb7c8b8
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxsatvikkushwaha1
 
CH-1.2 Performance analysis for mca.pptx
CH-1.2 Performance analysis for mca.pptxCH-1.2 Performance analysis for mca.pptx
CH-1.2 Performance analysis for mca.pptxshivam7050174471
 
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 structureSelf-Employed
 
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
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdfNayanChandak1
 
Algorithm 110801105245-phpapp01-120223065724-phpapp02
Algorithm 110801105245-phpapp01-120223065724-phpapp02Algorithm 110801105245-phpapp01-120223065724-phpapp02
Algorithm 110801105245-phpapp01-120223065724-phpapp02dhruv patel
 
Algorithm 110801105245-phpapp01
Algorithm 110801105245-phpapp01Algorithm 110801105245-phpapp01
Algorithm 110801105245-phpapp01Jay Patel
 
OutSystems Tips and Tricks
OutSystems Tips and TricksOutSystems Tips and Tricks
OutSystems Tips and TricksOutSystems
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptxRahikAhmed1
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of AlgorithmsBulbul Agrawal
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptxShaistaRiaz4
 

Similar to Lecture01 algorithm analysis (20)

Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
 
Design and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit oneDesign and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit one
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptx
 
CH-1.2 Performance analysis for mca.pptx
CH-1.2 Performance analysis for mca.pptxCH-1.2 Performance analysis for mca.pptx
CH-1.2 Performance analysis for mca.pptx
 
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
 
Algorithms.pdf
Algorithms.pdfAlgorithms.pdf
Algorithms.pdf
 
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
 
Lec1.ppt
Lec1.pptLec1.ppt
Lec1.ppt
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
 
Algorithm 110801105245-phpapp01-120223065724-phpapp02
Algorithm 110801105245-phpapp01-120223065724-phpapp02Algorithm 110801105245-phpapp01-120223065724-phpapp02
Algorithm 110801105245-phpapp01-120223065724-phpapp02
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Algorithm 110801105245-phpapp01
Algorithm 110801105245-phpapp01Algorithm 110801105245-phpapp01
Algorithm 110801105245-phpapp01
 
Lecture01.ppt
Lecture01.pptLecture01.ppt
Lecture01.ppt
 
OutSystems Tips and Tricks
OutSystems Tips and TricksOutSystems Tips and Tricks
OutSystems Tips and Tricks
 
Python algorithm
Python algorithmPython algorithm
Python algorithm
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
 
Parallel Algorithms
Parallel AlgorithmsParallel Algorithms
Parallel Algorithms
 

More from Zara Nawaz

Translation Look Aside buffer
Translation Look Aside buffer Translation Look Aside buffer
Translation Look Aside buffer Zara Nawaz
 
information security (network security methods)
information security (network security methods)information security (network security methods)
information security (network security methods)Zara Nawaz
 
information security(Public key encryption its characteristics and weakness, ...
information security(Public key encryption its characteristics and weakness, ...information security(Public key encryption its characteristics and weakness, ...
information security(Public key encryption its characteristics and weakness, ...Zara Nawaz
 
information security(Feistal Cipher)
information security(Feistal Cipher)information security(Feistal Cipher)
information security(Feistal Cipher)Zara Nawaz
 
Information security (Symmetric encryption, cryptography, crypto-analysis)
Information security (Symmetric encryption, cryptography, crypto-analysis)Information security (Symmetric encryption, cryptography, crypto-analysis)
Information security (Symmetric encryption, cryptography, crypto-analysis)Zara Nawaz
 
information security(authentication application, Authentication and Access Co...
information security(authentication application, Authentication and Access Co...information security(authentication application, Authentication and Access Co...
information security(authentication application, Authentication and Access Co...Zara Nawaz
 
information security (Audit mechanism, intrusion detection, password manageme...
information security (Audit mechanism, intrusion detection, password manageme...information security (Audit mechanism, intrusion detection, password manageme...
information security (Audit mechanism, intrusion detection, password manageme...Zara Nawaz
 
Information Security (Malicious Software)
Information Security (Malicious Software)Information Security (Malicious Software)
Information Security (Malicious Software)Zara Nawaz
 
Information Security (Firewall)
Information Security (Firewall)Information Security (Firewall)
Information Security (Firewall)Zara Nawaz
 
Information security ist lecture
Information security ist lectureInformation security ist lecture
Information security ist lectureZara Nawaz
 
Information Security (Digital Signatures)
Information Security (Digital Signatures)Information Security (Digital Signatures)
Information Security (Digital Signatures)Zara Nawaz
 

More from Zara Nawaz (11)

Translation Look Aside buffer
Translation Look Aside buffer Translation Look Aside buffer
Translation Look Aside buffer
 
information security (network security methods)
information security (network security methods)information security (network security methods)
information security (network security methods)
 
information security(Public key encryption its characteristics and weakness, ...
information security(Public key encryption its characteristics and weakness, ...information security(Public key encryption its characteristics and weakness, ...
information security(Public key encryption its characteristics and weakness, ...
 
information security(Feistal Cipher)
information security(Feistal Cipher)information security(Feistal Cipher)
information security(Feistal Cipher)
 
Information security (Symmetric encryption, cryptography, crypto-analysis)
Information security (Symmetric encryption, cryptography, crypto-analysis)Information security (Symmetric encryption, cryptography, crypto-analysis)
Information security (Symmetric encryption, cryptography, crypto-analysis)
 
information security(authentication application, Authentication and Access Co...
information security(authentication application, Authentication and Access Co...information security(authentication application, Authentication and Access Co...
information security(authentication application, Authentication and Access Co...
 
information security (Audit mechanism, intrusion detection, password manageme...
information security (Audit mechanism, intrusion detection, password manageme...information security (Audit mechanism, intrusion detection, password manageme...
information security (Audit mechanism, intrusion detection, password manageme...
 
Information Security (Malicious Software)
Information Security (Malicious Software)Information Security (Malicious Software)
Information Security (Malicious Software)
 
Information Security (Firewall)
Information Security (Firewall)Information Security (Firewall)
Information Security (Firewall)
 
Information security ist lecture
Information security ist lectureInformation security ist lecture
Information security ist lecture
 
Information Security (Digital Signatures)
Information Security (Digital Signatures)Information Security (Digital Signatures)
Information Security (Digital Signatures)
 

Recently uploaded

KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

Lecture01 algorithm analysis

  • 1. 1 Algorithms Analysis and Design Lecture 1 Prepared by ZARA
  • 2. 2 Major objective of this course is: ● Design and analysis of modern algorithms ● Different variants ● Accuracy ● Efficiency ● Comparing efficiencies ● Motivation thinking new algorithms ● Advanced designing techniques ● Real world problems will be taken as examples ● To create feelings about usefulness of this course Objective of This Course
  • 3. 3 On successful completion, students will be able to ● Argue and prove correctness of algorithms ● Derive and solve mathematical models of problems ● Reasoning when an algorithm calls certain approach ● Analyze average and worst-case running times ● Integrating approaches in dynamic and greedy algos. ● Use of graph theory in problems solving ● Advanced topics such as • Computational geometry, number theory etc. ● Several other algorithms such as • String matching, NP completeness, approximate algorithms etc. Expected Results
  • 4. 4 Lecture No 1 Introduction (What, Why and Where Algorithms . . .)
  • 5. 5 In this lecture we will cover the following ● What is Algorithm? ● Designing Techniques ● Model of Computation ● Algorithms as a technology ● Algorithms and other technologies ● Importance of algorithms ● Difference in Users and Developers ● Kinds of problems solved by algorithms ● Conclusion Today Covered
  • 6. 6 ● A computer algorithm is a detailed step-by-step method for solving a problem by using a computer. ● An algorithm is a sequence of unambiguous instructions for solving a problem in a finite amount of time. ● An Algorithm is well defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values as output. ● More generally, an Algorithm is any well defined computational procedure that takes collection of elements as input and produces a collection of elements as output. Algorithm Input output What is Algorithm?
  • 7. 7 ● Most basic and popular algorithms are ■ Sorting algorithms ■ Searching algorithms Which algorithm is best? ● Mainly, it depends upon various factors, for example in case of sorting ■ The number of items to be sorted ■ The extent to which the items are already sorted ■ Possible restrictions on the item values ■ The kind of storage device to be used etc. Popular Algorithms, Factors of Dependence
  • 8. 8 Problem ● The statement of the problem specifies, in general terms, the desired input/output relationship. Algorithm ● The algorithm describes a specific computational procedure for achieving input/output relationship. Example ● One might need to sort a sequence of numbers into non- decreasing order. Algorithms ● Various algorithms e.g. merge sort, quick sort, heap sorts etc. One Problem, Many Algorithms
  • 9. 9 ● Brute Force ■ Straightforward, naive approach ■ Mostly expensive ● Divide-and-Conquer ■ Divide into smaller sub-problems ● Iterative Improvement ■ Improve one change at a time ● Decrease-and-Conquer ■ Decrease instance size ● Transform-and-Conquer ■ Modify problem first and then solve it ● Space and Time Tradeoffs ■ Use more space now to save time later Important Designing Techniques
  • 10. 10 ● Greedy Approach ■ Locally optimal decisions, can not change once made. ■ Efficient ■ Easy to implement ■ The solution is expected to be optimal ■ Every problem may not have greedy solution ● Dynamic programming ■ Decompose into sub-problems like divide and conquer ■ Sub-problems are dependant ■ Record results of smaller sub-problems ■ Re-use it for further occurrence ■ Mostly reduces complexity exponential to polynomial Some of the Important Designing Techniques
  • 11. 11 ● Analysis ■ How does system work? ■ Breaking a system down to known components ■ How components (processes) relate to each other ■ Breaking a process down to known functions ● Synthesis ■ Building tools ■ Building functions with supporting tools ■ Composing functions to form a process ■ How components should be put together? ■ Final solution Problem Solving Phases
  • 12. 12 ● Problem ● Strategy ● Algorithm ■ Input ■ Output ■ Steps ● Analysis ■ Correctness ■ Time & Space ■ Optimality ● Implementation ● Verification Problem Solving Process
  • 13. 13 ● Design assumption ■ Level of abstraction which meets our requirements ■ Neither more nor less e.g. [0, 1] infinite continuous interval ● Analysis independent of the variations in ■ Machine ■ Operating system ■ Programming languages ■ Compiler etc. ● Low-level details will not be considered ● Our model will be an abstraction of a standard generic single-processor machine, called a random access machine or RAM. Model of Computation (Assumptions)
  • 14. 14 ● A RAM is assumed to be an idealized machine ■ Infinitely large random-access memory ■ Instructions execute sequentially ● Every instruction is in fact a basic operation on two values in the machines memory which takes unit time. ● These might be characters or integers. ● Example of basic operations include ■ Assigning a value to a variable ■ Arithmetic operation (+, - , × , /) on integers ■ Performing any comparison e.g. a < b ■ Boolean operations ■ Accessing an element of an array. Model of Computation (Assumptions)
  • 15. 15 ● In theoretical analysis, computational complexity ■ Estimated in asymptotic sense, i.e. ■ Estimating for large inputs ● Big O, Omega, Theta etc. notations are used to compute the complexity ● Asymptotic notations are used because different implementations of algorithm may differ in efficiency ● Efficiencies of two given algorithm are related ■ By a constant multiplicative factor ■ Called hidden constant. Model of Computation (Assumptions)
  • 16. 16 First poor assumption ● We assumed that each basic operation takes constant time, i.e. model allows ■ Adding ■ Multiplying ■ Comparing etc. two numbers of any length in constant time ● Addition of two numbers takes a unit time! ■ Not good because numbers may be arbitrarily ● Addition and multiplication both take unit time! ■ Again very bad assumption Drawbacks in Model of Computation
  • 17. 17 Finally what about Our Model? ● But with all these weaknesses, our model is not so bad because we have to give the ■ Comparison not the absolute analysis of any algorithm. ■ We have to deal with large inputs not with the small size ● Model seems to work well describing computational power of modern nonparallel machines Can we do Exact Measure of Efficiency ? ● Exact, not asymptotic, measure of efficiency can be sometimes computed but it usually requires certain assumptions concerning implementation Model of Computation not so Bad
  • 18. 18 ● Analysis will be performed with respect to this computational model for comparison of algorithms ● We will give asymptotic analysis not detailed comparison i.e. for large inputs ● We will use generic uniprocessor random-access machine (RAM) in analysis ■ All memory equally expensive to access ■ No concurrent operations ■ All reasonable instructions take unit time, except, of course, function calls Summary : Computational Model
  • 19. 19 Algorithm As a Technology ● Efficiency: ● – Different algorithms solve the same problem often differ noticeably in their efficiency ● – These differences can be much more significant than difference due to hardware and software ● For example, insertion sort takes time roughly equal to c1n 2 (c1 is constant) to sort n items. But, merge sort takes time roughly equal to c2nlg n (c2 is constant)
  • 20. 20 Algorithm As a Technology ● Algorithms as a technology • For example, assume a faster computer A (1010 instructions/sec) running insertion sort against a slower computer B (107 instructions/sec) running merge sort. • Suppose that c1=2, c2=50 and n = 107 . • the execution time of computer A is 2(107 ) 2 / 1010 instructions/sec = 20,000 seconds • the execution time of computer B is 50 · 107 lg 107 / 107 instructions/sec = 1,163 seconds
  • 21. 21 ● What, Why and Where Algorithms? ● Designing Techniques ● Problem solving Phases and Procedure ● Model of computations ■ Major assumptions at design and analysis level ■ Merits and demerits, justification of assumptions taken ● We proved that algorithm is a technology ● Compared algorithmic technology with others ● Discussed importance of algorithms ■ In almost all areas of computer science and engineering ■ Algorithms make difference in users and developers Conclusion