Design and analysis of
algorithms
Introduction to DAA Lec 1
Why we need to study this subject?
 This course introduces the design and analysis of algorithms.
 Perhaps it is meaningful to discuss a very important question first: Why should we
study algorithms?
 It is commonly believed that in order to obtain high speed computation, it suffices
to have a very high speed computer.
 This, however, is not entirely true. We illustrate this with an experiment whose
results make it clear that a good algorithm implemented on a slow computer may
perform much better than a bad algorithm implemented on a fast computer.
Design and analysis of algorithm
Problem
Data structure
Algorithm
Program
Computer
+
Input Output
What is algorithm
 The word algorithm comes from name of Persian author “Abu Jaffar Mohammad” in
825AD.
 Def
An algorithm is a sequence of computational steps that transform the input into
the output.
 Another def.
Finite set of steps to solve a problem.
What is analysis
 Analysis is process of comparing two algorithms w.r.t time and space.
 Analysis can be of two types
1:Prior
Analysis before execution
Independent of hardware just focus on iterations
Give approx. value
2:Posterior
Analysis after execution
Always depend on hardware
Give exact value
Fundamentals for algorithm
 Input (zero input or more input)
 Output (at least one)
 Definiteness ( no confusion for computer, unambigious)
 Finiteness (always terminate)
 Effectiveness
Design of algorithms
Different ways of representing an algorithm is
 Natural language
 Pseudo code
 Flow chart
Fields in this course
 How to device algorithm?
 How to validate?
 How to analyse ?
 How to test?
Difference between algorithm, pseudo
code and program
 Algorithm
 A step by step method to
solve a problem .
 Its written in natural
language.
 For example a recipe for
preparing a dish.
 Program
 It is exact code in
any particular
programming
language.
 Pseudo code
 It is simple version of
programing code that does
not require any strict
programming language
syntax.

Design and analysis of algorithm lec 1.pptx

  • 1.
    Design and analysisof algorithms Introduction to DAA Lec 1
  • 2.
    Why we needto study this subject?  This course introduces the design and analysis of algorithms.  Perhaps it is meaningful to discuss a very important question first: Why should we study algorithms?  It is commonly believed that in order to obtain high speed computation, it suffices to have a very high speed computer.  This, however, is not entirely true. We illustrate this with an experiment whose results make it clear that a good algorithm implemented on a slow computer may perform much better than a bad algorithm implemented on a fast computer.
  • 3.
    Design and analysisof algorithm Problem Data structure Algorithm Program Computer + Input Output
  • 4.
    What is algorithm The word algorithm comes from name of Persian author “Abu Jaffar Mohammad” in 825AD.  Def An algorithm is a sequence of computational steps that transform the input into the output.  Another def. Finite set of steps to solve a problem.
  • 5.
    What is analysis Analysis is process of comparing two algorithms w.r.t time and space.  Analysis can be of two types 1:Prior Analysis before execution Independent of hardware just focus on iterations Give approx. value 2:Posterior Analysis after execution Always depend on hardware Give exact value
  • 6.
    Fundamentals for algorithm Input (zero input or more input)  Output (at least one)  Definiteness ( no confusion for computer, unambigious)  Finiteness (always terminate)  Effectiveness
  • 7.
    Design of algorithms Differentways of representing an algorithm is  Natural language  Pseudo code  Flow chart
  • 8.
    Fields in thiscourse  How to device algorithm?  How to validate?  How to analyse ?  How to test?
  • 9.
    Difference between algorithm,pseudo code and program  Algorithm  A step by step method to solve a problem .  Its written in natural language.  For example a recipe for preparing a dish.  Program  It is exact code in any particular programming language.  Pseudo code  It is simple version of programing code that does not require any strict programming language syntax.