SlideShare a Scribd company logo
Advanced Algorithms Analysis and
Design
By
Dr. Nazir Ahmad Zafar
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
• M. Sc. Mathematics: 1989-91
Quaid-i-Azam University, Islamabad
• M. Phil Mathematics: 1991-93
Quaid-i-Azam University, Islamabad
• M. Sc. Nuclear Engineering: 1993-94
Quaid-i-Azam University, Islamabad
• PhD Computer Science: 2000-04
Kyushu University, Japan
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Objective of This Course
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.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Expected Results
Lecture No 1
Introduction
(What, Why and Where Algorithms . . .)
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Today Covered
• 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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
What is Algorithm?
• 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.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Popular Algorithms, Factors of Dependence
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.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
One Problem, Many Algorithms
• 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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Important Designing Techniques
• 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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Some of the Important Designing Techniques
• 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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
• Problem
• Strategy
• Algorithm
– Input
– Output
– Steps
• Analysis
– Correctness
– Time & Space
– Optimality
• Implementation
• Verification
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Problem Solving Process
• 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.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Model of Computation (Assumptions)
• 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.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Model of Computation (Assumptions)
• 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.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Model of Computation (Assumptions)
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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Drawbacks in Model of Computation
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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Model of Computation not so Bad
• 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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Summary : Computational Model
• 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
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Conclusion

More Related Content

Similar to Lecture01.ppt

Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
ShaistaRiaz4
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
jayavignesh86
 
Models of Operational research, Advantages & disadvantages of Operational res...
Models of Operational research, Advantages & disadvantages of Operational res...Models of Operational research, Advantages & disadvantages of Operational res...
Models of Operational research, Advantages & disadvantages of Operational res...
Sunny Mervyne Baa
 
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
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
Dr. Pankaj Agarwal
 
Lecture01 algorithm analysis
Lecture01 algorithm analysisLecture01 algorithm analysis
Lecture01 algorithm analysis
Zara Nawaz
 
Unified modeling language basics and slides
Unified modeling language basics and slidesUnified modeling language basics and slides
Unified modeling language basics and slides
venkatasubramanianSr5
 
OR
OROR
Modeling and analysis
Modeling and analysisModeling and analysis
Modeling and analysis
Shwetabh Jaiswal
 
PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko
Neotys
 
Introduction to Algorithms And DataStructure
Introduction to Algorithms And DataStructureIntroduction to Algorithms And DataStructure
Introduction to Algorithms And DataStructure
Prasanna996462
 
Algorithms and Data Structures
Algorithms and Data StructuresAlgorithms and Data Structures
Algorithms and Data Structures
sonykhan3
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
jinkhatima
 
Dss6 7
Dss6 7Dss6 7
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
RahikAhmed1
 
lect 1-ds algo(final)_2.pdf
lect 1-ds  algo(final)_2.pdflect 1-ds  algo(final)_2.pdf
lect 1-ds algo(final)_2.pdf
MuhammadUmerIhtisham
 
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
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
NayanChandak1
 
Modeling and analysis
Modeling and analysisModeling and analysis
Modeling and analysis
Shwetabh Jaiswal
 
CS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsCS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of Algorithms
Krishnan MuthuManickam
 

Similar to Lecture01.ppt (20)

Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
 
Models of Operational research, Advantages & disadvantages of Operational res...
Models of Operational research, Advantages & disadvantages of Operational res...Models of Operational research, Advantages & disadvantages of Operational res...
Models of Operational research, Advantages & disadvantages of Operational res...
 
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...
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
 
Lecture01 algorithm analysis
Lecture01 algorithm analysisLecture01 algorithm analysis
Lecture01 algorithm analysis
 
Unified modeling language basics and slides
Unified modeling language basics and slidesUnified modeling language basics and slides
Unified modeling language basics and slides
 
OR
OROR
OR
 
Modeling and analysis
Modeling and analysisModeling and analysis
Modeling and analysis
 
PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko PAC 2019 virtual Alexander Podelko
PAC 2019 virtual Alexander Podelko
 
Introduction to Algorithms And DataStructure
Introduction to Algorithms And DataStructureIntroduction to Algorithms And DataStructure
Introduction to Algorithms And DataStructure
 
Algorithms and Data Structures
Algorithms and Data StructuresAlgorithms and Data Structures
Algorithms and Data Structures
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
 
Dss6 7
Dss6 7Dss6 7
Dss6 7
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
 
lect 1-ds algo(final)_2.pdf
lect 1-ds  algo(final)_2.pdflect 1-ds  algo(final)_2.pdf
lect 1-ds algo(final)_2.pdf
 
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
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
 
Modeling and analysis
Modeling and analysisModeling and analysis
Modeling and analysis
 
CS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsCS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of Algorithms
 

Recently uploaded

Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
ScyllaDB
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
zjhamm304
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
ScyllaDB
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
leebarnesutopia
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
HarpalGohil4
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Ukraine
 

Recently uploaded (20)

Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
 

Lecture01.ppt

  • 1. Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
  • 2. • M. Sc. Mathematics: 1989-91 Quaid-i-Azam University, Islamabad • M. Phil Mathematics: 1991-93 Quaid-i-Azam University, Islamabad • M. Sc. Nuclear Engineering: 1993-94 Quaid-i-Azam University, Islamabad • PhD Computer Science: 2000-04 Kyushu University, Japan Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
  • 3. 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Objective of This Course
  • 4. 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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Expected Results
  • 5. Lecture No 1 Introduction (What, Why and Where Algorithms . . .) Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
  • 6. 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Today Covered
  • 7. • 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design What is Algorithm?
  • 8. • 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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Popular Algorithms, Factors of Dependence
  • 9. 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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design One Problem, Many Algorithms
  • 10. • 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Important Designing Techniques
  • 11. • 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Some of the Important Designing Techniques
  • 12. • 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
  • 13. • Problem • Strategy • Algorithm – Input – Output – Steps • Analysis – Correctness – Time & Space – Optimality • Implementation • Verification Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Problem Solving Process
  • 14. • 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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Model of Computation (Assumptions)
  • 15. • 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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Model of Computation (Assumptions)
  • 16. • 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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Model of Computation (Assumptions)
  • 17. 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Drawbacks in Model of Computation
  • 18. 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Model of Computation not so Bad
  • 19. • 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Summary : Computational Model
  • 20. • 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Conclusion