SlideShare uma empresa Scribd logo
1 de 25
Course Title: Design and Analysis of
Algorithms
CHAPTER 1: INTRODUCTION
• Algorithms
• Analyzing Algorithms
• Designing Algorithms
Algorithms?
Why Algorithms is needed?
computational problems in general and of the
algorithms needed to solve them
What is Algorithms?
An algorithm is any well-defined
computational procedure
With What?
It takes some value, or set of values, as input
and produces some value, or set of values, as
output
Definition: Algorithms
• An algorithm is thus a sequence of
computational steps that transform the input
into the output. And also view an algorithm as
a tool for solving a well-specified
computational problem.
Example:
• Input: A sequence of n numbers a1, a2, . . . , an .
• Output: A permutation (reordering)
of the input sequence such that
Ex:
Given an input sequence such as 31, 41, 59, 26,
41, 58 , a sorting algorithm returns as output
the sequence 26, 31, 41, 41, 58, 59
Law of Algorithms
• An algorithm is said to be correct if, for every
input instance, it halts with the correct
output. We say that a correct algorithm solves
the given computational problem.
• An incorrect algorithm might not halt at all on
some input instances, or it might halt with
other than the desired answer.
Steps to design the Algorithm
1. Under stand the problem
2. Decide about the way to solve the problem
3. Design the algorithm
4. Prove the correctness
5. Analysis the algorithm
6. Code the algorithm
Analyzing the Algorithms
Why is it Important?
It has come to mean predicting the resources
that the algorithm requires.
Occasionally, resources such as memory,
communication bandwidth, or logic gates are
of primary concern,
but most often it is computational time that
we want to measure
Analysis of Algorithms
• Analysis of Algorithms is the area of computer science that
provides tools to analyze the efficiency of different methods of
solutions.
• How do we compare the time efficiency of two algorithms that
solve the same problem?
Naïve Approach: implement these algorithms in a programming
language (C++), and run them to compare their time
requirements. Comparing the programs (instead of algorithms)
has difficulties.
– How are the algorithms coded?
• Comparing running times means comparing the implementations.
• We should not compare implementations, because they are sensitive to programming
style that may cloud the issue of which algorithm is inherently more efficient.
– What computer should we use?
• We should compare the efficiency of the algorithms independently of a particular
computer.
– What data should the program use?
• Any analysis must be independent of specific data.
CENG 213 Data Structures 10
Analysis of Algorithms
• When we analyze algorithms, we should employ
mathematical techniques that analyze algorithms
independently of specific implementations,
computers, or data.
• To analyze algorithms:
– First, we start to count the number of significant
operations in a particular solution to assess its
efficiency.
– Then, we will express the efficiency of algorithms using
growth functions.
Before Analyzing
• What to do?
have a model of the implementation technology
that will be used
it means, resources of that technology and their
costs and running time
Example:
random-access machine (RAM)
Requirement for Analayze
• mathematical tools required like, discrete
combinatorics, elementary probability theory,
algebraic dexterity, most significant terms in a
formula. (behavior of the algorithm may
change different I/P)
• find a means of expression that is simple to
write and manipulate, shows the important
characteristics of an algorithm's resource
requirements, and suppresses tedious details.
13
General Rules for Estimation
• Loops: The running time of a loop is at most the
running time of the statements inside of that loop
times the number of iterations.
• Nested Loops: Running time of a nested loop
containing a statement in the inner most loop is the
running time of statement multiplied by the product
of the sized of all loops.
• Consecutive Statements: Just add the running times
of those consecutive statements.
• If/Else: Never more than the running time of the test
plus the larger of running times of S1 and S2.
Importance of Analyze Algorithm
• Need to recognize limitations of various algorithms
for solving a problem
• Need to understand relationship between problem
size and running time
– When is a running program not good enough?
• Need to learn how to analyze an algorithm's running
time without coding it
• Need to learn techniques for writing more efficient
code
• Need to recognize bottlenecks in code as well as
which parts of code are easiest to optimize
Measuring Complexity Again
• The worst case running time of an algorithm is the function
defined by the maximum number of steps taken on any
instance of size n.
• The best case running time of an algorithm is the function
defined by the minimum number of steps taken on any
instance of size n.
• The average-case running time of an algorithm is the function
defined by an average number of steps taken on any instance
of size n.
• Which of these is the best to use?
Order of Growth
• It is the rate of growth, or order of growth, of
the running time
• we write that insertion sort, for example, has
a worst-case running time of θ (n2)
Best, Worst, and Average Case
Basic Common Growth Rates
1 constant
log n logarithmic
n linear
n log n n-log-n
n2 quadratic
n3 cubic
2n exponential
n! factorial
Running times for small inputs
• many ways to design algorithms.
• Learn general approaches to algorithm design
– Divide and conquer
– Greedy method
– Dynamic Programming
– Basic Search and Traversal Technique
– Graph Theory
– Linear Programming
– Approximation Algorithm
– NP Problem
Designing algorithms
Designing algorithms
• Two approaches:
1. incremental approach
2. Divide and conquer approach
The divide-and-conquer approach
recursive in structure
→to solve a given problem, they call
themselves recursively one or more times to
deal with closely related sub problems.
Three steps at each level of the
recursion:
• Divide
• Conquer (recurcively)
• Combine
Analyzing divide-and-conquer
algorithms
• When an algorithm contains a recursive call to
itself, its running time can often be described
by a recurrence equation or recurrence, which
describes the overall running time on a
problem of size n in terms of the running time
on smaller inputs.
A recurrence for the running time of a divide-
and-conquer algorithm is based on the three
steps of the basic paradigm
• Examine methods of analyzing algorithm
correctness and efficiency
– Recursion equations
– Lower bound techniques
– O,Omega and Theta notations for best/worst/average case analysis
• Decide whether some problems have no
solution in reasonable time
– List all permutations of n objects (takes n! steps)
– Travelling salesman problem
• Investigate memory usage as a different
measure of efficiency

Mais conteúdo relacionado

Semelhante a Chapter1.1 Introduction.ppt

Slides [DAA] Unit 2 Ch 2.pdf
Slides [DAA] Unit 2 Ch 2.pdfSlides [DAA] Unit 2 Ch 2.pdf
Slides [DAA] Unit 2 Ch 2.pdfVijayraj799513
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of AlgorithmsBulbul Agrawal
 
Data Structures - Lecture 1 [introduction]
Data Structures - Lecture 1 [introduction]Data Structures - Lecture 1 [introduction]
Data Structures - Lecture 1 [introduction]Muhammad Hammad Waseem
 
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
 
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
 
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
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)jehan1987
 
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
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptxShaistaRiaz4
 
Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity CalculationAkhil Kaushik
 
Algorithms Analysis.pdf
Algorithms Analysis.pdfAlgorithms Analysis.pdf
Algorithms Analysis.pdfShaistaRiaz4
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.pptALIZAIB KHAN
 

Semelhante a Chapter1.1 Introduction.ppt (20)

Slides [DAA] Unit 2 Ch 2.pdf
Slides [DAA] Unit 2 Ch 2.pdfSlides [DAA] Unit 2 Ch 2.pdf
Slides [DAA] Unit 2 Ch 2.pdf
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
 
Data Structures - Lecture 1 [introduction]
Data Structures - Lecture 1 [introduction]Data Structures - Lecture 1 [introduction]
Data Structures - Lecture 1 [introduction]
 
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
 
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
 
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
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)
 
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
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
 
Algorithms
Algorithms Algorithms
Algorithms
 
Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity Calculation
 
Chap5 slides
Chap5 slidesChap5 slides
Chap5 slides
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
 
Cs 331 Data Structures
Cs 331 Data StructuresCs 331 Data Structures
Cs 331 Data Structures
 
Lecture01.ppt
Lecture01.pptLecture01.ppt
Lecture01.ppt
 
Algorithms Analysis.pdf
Algorithms Analysis.pdfAlgorithms Analysis.pdf
Algorithms Analysis.pdf
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.ppt
 
Unit 2 algorithm
Unit   2 algorithmUnit   2 algorithm
Unit 2 algorithm
 

Mais de Tekle12

Chapter 3 Naming in distributed system.pptx
Chapter 3 Naming in distributed system.pptxChapter 3 Naming in distributed system.pptx
Chapter 3 Naming in distributed system.pptxTekle12
 
Chapter Introductionn to distributed system .pptx
Chapter Introductionn to distributed system .pptxChapter Introductionn to distributed system .pptx
Chapter Introductionn to distributed system .pptxTekle12
 
Chapter 6emerging technology - EMTE.pptx
Chapter 6emerging technology - EMTE.pptxChapter 6emerging technology - EMTE.pptx
Chapter 6emerging technology - EMTE.pptxTekle12
 
Chapter 4about internet of things IoT.pptx
Chapter 4about internet of things IoT.pptxChapter 4about internet of things IoT.pptx
Chapter 4about internet of things IoT.pptxTekle12
 
Design and analysis of algorithm chapter two.pptx
Design and analysis of algorithm chapter two.pptxDesign and analysis of algorithm chapter two.pptx
Design and analysis of algorithm chapter two.pptxTekle12
 
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
 
Chapter 6 WSN.ppt
Chapter 6 WSN.pptChapter 6 WSN.ppt
Chapter 6 WSN.pptTekle12
 
Chapter 2.1.pptx
Chapter 2.1.pptxChapter 2.1.pptx
Chapter 2.1.pptxTekle12
 
CHAPTER-3a.ppt
CHAPTER-3a.pptCHAPTER-3a.ppt
CHAPTER-3a.pptTekle12
 
CHAPTER-5.ppt
CHAPTER-5.pptCHAPTER-5.ppt
CHAPTER-5.pptTekle12
 
CHAPTER-2.ppt
CHAPTER-2.pptCHAPTER-2.ppt
CHAPTER-2.pptTekle12
 
CHAPTER-1.ppt
CHAPTER-1.pptCHAPTER-1.ppt
CHAPTER-1.pptTekle12
 
Chapter 1 - Intro to Emerging Technologies.pptx
Chapter 1 - Intro to Emerging Technologies.pptxChapter 1 - Intro to Emerging Technologies.pptx
Chapter 1 - Intro to Emerging Technologies.pptxTekle12
 
chapter 3.2 TCP.pptx
chapter 3.2 TCP.pptxchapter 3.2 TCP.pptx
chapter 3.2 TCP.pptxTekle12
 
Chapter 2.1.pptx
Chapter 2.1.pptxChapter 2.1.pptx
Chapter 2.1.pptxTekle12
 
Chapter 1 - EMTE.pptx
Chapter 1 - EMTE.pptxChapter 1 - EMTE.pptx
Chapter 1 - EMTE.pptxTekle12
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptxTekle12
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptxTekle12
 
chapter 6.1.pptx
chapter 6.1.pptxchapter 6.1.pptx
chapter 6.1.pptxTekle12
 
Chapter 4.pptx
Chapter 4.pptxChapter 4.pptx
Chapter 4.pptxTekle12
 

Mais de Tekle12 (20)

Chapter 3 Naming in distributed system.pptx
Chapter 3 Naming in distributed system.pptxChapter 3 Naming in distributed system.pptx
Chapter 3 Naming in distributed system.pptx
 
Chapter Introductionn to distributed system .pptx
Chapter Introductionn to distributed system .pptxChapter Introductionn to distributed system .pptx
Chapter Introductionn to distributed system .pptx
 
Chapter 6emerging technology - EMTE.pptx
Chapter 6emerging technology - EMTE.pptxChapter 6emerging technology - EMTE.pptx
Chapter 6emerging technology - EMTE.pptx
 
Chapter 4about internet of things IoT.pptx
Chapter 4about internet of things IoT.pptxChapter 4about internet of things IoT.pptx
Chapter 4about internet of things IoT.pptx
 
Design and analysis of algorithm chapter two.pptx
Design and analysis of algorithm chapter two.pptxDesign and analysis of algorithm chapter two.pptx
Design and analysis of algorithm chapter two.pptx
 
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
 
Chapter 6 WSN.ppt
Chapter 6 WSN.pptChapter 6 WSN.ppt
Chapter 6 WSN.ppt
 
Chapter 2.1.pptx
Chapter 2.1.pptxChapter 2.1.pptx
Chapter 2.1.pptx
 
CHAPTER-3a.ppt
CHAPTER-3a.pptCHAPTER-3a.ppt
CHAPTER-3a.ppt
 
CHAPTER-5.ppt
CHAPTER-5.pptCHAPTER-5.ppt
CHAPTER-5.ppt
 
CHAPTER-2.ppt
CHAPTER-2.pptCHAPTER-2.ppt
CHAPTER-2.ppt
 
CHAPTER-1.ppt
CHAPTER-1.pptCHAPTER-1.ppt
CHAPTER-1.ppt
 
Chapter 1 - Intro to Emerging Technologies.pptx
Chapter 1 - Intro to Emerging Technologies.pptxChapter 1 - Intro to Emerging Technologies.pptx
Chapter 1 - Intro to Emerging Technologies.pptx
 
chapter 3.2 TCP.pptx
chapter 3.2 TCP.pptxchapter 3.2 TCP.pptx
chapter 3.2 TCP.pptx
 
Chapter 2.1.pptx
Chapter 2.1.pptxChapter 2.1.pptx
Chapter 2.1.pptx
 
Chapter 1 - EMTE.pptx
Chapter 1 - EMTE.pptxChapter 1 - EMTE.pptx
Chapter 1 - EMTE.pptx
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptx
 
chapter 6.1.pptx
chapter 6.1.pptxchapter 6.1.pptx
chapter 6.1.pptx
 
Chapter 4.pptx
Chapter 4.pptxChapter 4.pptx
Chapter 4.pptx
 

Último

Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 217djon017
 
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...Boston Institute of Analytics
 
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...Thomas Poetter
 
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...Amil Baba Dawood bangali
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.natarajan8993
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Cantervoginip
 
Identifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population MeanIdentifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population MeanMYRABACSAFRA2
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsVICTOR MAESTRE RAMIREZ
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Boston Institute of Analytics
 
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degreeyuu sss
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPTBoston Institute of Analytics
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfJohn Sterrett
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...Boston Institute of Analytics
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our WorldEduminds Learning
 
Vision, Mission, Goals and Objectives ppt..pptx
Vision, Mission, Goals and Objectives ppt..pptxVision, Mission, Goals and Objectives ppt..pptx
Vision, Mission, Goals and Objectives ppt..pptxellehsormae
 
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024Timothy Spann
 

Último (20)

Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2
 
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
 
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
 
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Canter
 
Identifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population MeanIdentifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population Mean
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business Professionals
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
 
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdf
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our World
 
Vision, Mission, Goals and Objectives ppt..pptx
Vision, Mission, Goals and Objectives ppt..pptxVision, Mission, Goals and Objectives ppt..pptx
Vision, Mission, Goals and Objectives ppt..pptx
 
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
 

Chapter1.1 Introduction.ppt

  • 1. Course Title: Design and Analysis of Algorithms
  • 2. CHAPTER 1: INTRODUCTION • Algorithms • Analyzing Algorithms • Designing Algorithms
  • 3. Algorithms? Why Algorithms is needed? computational problems in general and of the algorithms needed to solve them What is Algorithms? An algorithm is any well-defined computational procedure With What? It takes some value, or set of values, as input and produces some value, or set of values, as output
  • 4. Definition: Algorithms • An algorithm is thus a sequence of computational steps that transform the input into the output. And also view an algorithm as a tool for solving a well-specified computational problem.
  • 5. Example: • Input: A sequence of n numbers a1, a2, . . . , an . • Output: A permutation (reordering) of the input sequence such that Ex: Given an input sequence such as 31, 41, 59, 26, 41, 58 , a sorting algorithm returns as output the sequence 26, 31, 41, 41, 58, 59
  • 6. Law of Algorithms • An algorithm is said to be correct if, for every input instance, it halts with the correct output. We say that a correct algorithm solves the given computational problem. • An incorrect algorithm might not halt at all on some input instances, or it might halt with other than the desired answer.
  • 7. Steps to design the Algorithm 1. Under stand the problem 2. Decide about the way to solve the problem 3. Design the algorithm 4. Prove the correctness 5. Analysis the algorithm 6. Code the algorithm
  • 8. Analyzing the Algorithms Why is it Important? It has come to mean predicting the resources that the algorithm requires. Occasionally, resources such as memory, communication bandwidth, or logic gates are of primary concern, but most often it is computational time that we want to measure
  • 9. Analysis of Algorithms • Analysis of Algorithms is the area of computer science that provides tools to analyze the efficiency of different methods of solutions. • How do we compare the time efficiency of two algorithms that solve the same problem? Naïve Approach: implement these algorithms in a programming language (C++), and run them to compare their time requirements. Comparing the programs (instead of algorithms) has difficulties. – How are the algorithms coded? • Comparing running times means comparing the implementations. • We should not compare implementations, because they are sensitive to programming style that may cloud the issue of which algorithm is inherently more efficient. – What computer should we use? • We should compare the efficiency of the algorithms independently of a particular computer. – What data should the program use? • Any analysis must be independent of specific data.
  • 10. CENG 213 Data Structures 10 Analysis of Algorithms • When we analyze algorithms, we should employ mathematical techniques that analyze algorithms independently of specific implementations, computers, or data. • To analyze algorithms: – First, we start to count the number of significant operations in a particular solution to assess its efficiency. – Then, we will express the efficiency of algorithms using growth functions.
  • 11. Before Analyzing • What to do? have a model of the implementation technology that will be used it means, resources of that technology and their costs and running time Example: random-access machine (RAM)
  • 12. Requirement for Analayze • mathematical tools required like, discrete combinatorics, elementary probability theory, algebraic dexterity, most significant terms in a formula. (behavior of the algorithm may change different I/P) • find a means of expression that is simple to write and manipulate, shows the important characteristics of an algorithm's resource requirements, and suppresses tedious details.
  • 13. 13 General Rules for Estimation • Loops: The running time of a loop is at most the running time of the statements inside of that loop times the number of iterations. • Nested Loops: Running time of a nested loop containing a statement in the inner most loop is the running time of statement multiplied by the product of the sized of all loops. • Consecutive Statements: Just add the running times of those consecutive statements. • If/Else: Never more than the running time of the test plus the larger of running times of S1 and S2.
  • 14. Importance of Analyze Algorithm • Need to recognize limitations of various algorithms for solving a problem • Need to understand relationship between problem size and running time – When is a running program not good enough? • Need to learn how to analyze an algorithm's running time without coding it • Need to learn techniques for writing more efficient code • Need to recognize bottlenecks in code as well as which parts of code are easiest to optimize
  • 15. Measuring Complexity Again • The worst case running time of an algorithm is the function defined by the maximum number of steps taken on any instance of size n. • The best case running time of an algorithm is the function defined by the minimum number of steps taken on any instance of size n. • The average-case running time of an algorithm is the function defined by an average number of steps taken on any instance of size n. • Which of these is the best to use?
  • 16. Order of Growth • It is the rate of growth, or order of growth, of the running time • we write that insertion sort, for example, has a worst-case running time of θ (n2)
  • 17. Best, Worst, and Average Case
  • 18. Basic Common Growth Rates 1 constant log n logarithmic n linear n log n n-log-n n2 quadratic n3 cubic 2n exponential n! factorial
  • 19. Running times for small inputs
  • 20. • many ways to design algorithms. • Learn general approaches to algorithm design – Divide and conquer – Greedy method – Dynamic Programming – Basic Search and Traversal Technique – Graph Theory – Linear Programming – Approximation Algorithm – NP Problem Designing algorithms
  • 21. Designing algorithms • Two approaches: 1. incremental approach 2. Divide and conquer approach The divide-and-conquer approach recursive in structure →to solve a given problem, they call themselves recursively one or more times to deal with closely related sub problems.
  • 22. Three steps at each level of the recursion: • Divide • Conquer (recurcively) • Combine
  • 23. Analyzing divide-and-conquer algorithms • When an algorithm contains a recursive call to itself, its running time can often be described by a recurrence equation or recurrence, which describes the overall running time on a problem of size n in terms of the running time on smaller inputs.
  • 24. A recurrence for the running time of a divide- and-conquer algorithm is based on the three steps of the basic paradigm
  • 25. • Examine methods of analyzing algorithm correctness and efficiency – Recursion equations – Lower bound techniques – O,Omega and Theta notations for best/worst/average case analysis • Decide whether some problems have no solution in reasonable time – List all permutations of n objects (takes n! steps) – Travelling salesman problem • Investigate memory usage as a different measure of efficiency