Algorithm Analysis Design Lecture1 PowerPoint Presentation
Algorithm Analysis Design Lecture1 PowerPoint Presentation
Algorithm Analysis Design Lecture1 PowerPoint Presentation
ECEG-5501
Introduction to Algorithm
Analysis & Design
Introduction
What is Algorithm?
a sequence of unambiguous instructions for
solving a problem, i.e. for obtaining a required
output for any legitimate input in a finite
amount of time.
Introduction
What is a problem?
Roughly, a problem specifies what set of outputs is
desired for each given set of inputs.
Example: The Sorting Problem
A problem instance is just a specific set of inputs.
Solving a problem instance consists of specifying a
procedure for converting the inputs to an output of the
desired form (called a solution).
An algorithm that is guaranteed to result in a solution
for every instance is said to be correct.
Note that a given instance may have either no
solutions or more than one solution.
11/13/2014
Introduction
Introduction
What is a program?
A program is the expression of an algorithm in
a programming language
A set of instructions which the computer will
follow to solve a problem
Introduction
Important points
Non-ambiguity
Range of inputs
Several algorithms for solving the same problem
11/13/2014
Introduction
while do
repeat until
Introduction
Pseudo code
C
false
true
true
S1
next statement
S2
next statement
if then
if then else
Introduction
Pseudo code
for k 1 to n do
.
.
.
done n times
11/13/2014
Introduction
Pseudo code
while do
false
C
true
next statement
Introduction
Pseudo code
repeat until
true
C
false
next statement
Introduction
Design an algorithm
Prove correctness
Analyze the algorithm
Code the algorithm
11/13/2014
Introduction
Introduction
Prove correctness
Correct output for every legitimate input in finite
time
By Mathematical induction
Introduction
Optimality
(What is the minimum amount of effort any algorithm will need to exert
to solve the problem?)
11/13/2014
Introduction
Coding
How the objects and operations in the algorithm are
represented in the chosen programming language?
Introduction
Sorting
Searching
String Processing
Combinatorial Problems
Geometric Problems
Numerical Problems
Introduction
Searching
find a given search key in a given set
String Processing
String is a sequence of characters from alphabet
search a word in a text (string matching)
Graph Problems
Collections of vertexes some of them connected by line segments
includes graph traversal problems, shortest-path algorithms, traveling
salesman problem, graph coloring problems (event scheduling)
11/13/2014
Introduction
Numerical Problems
solve equations & systems of equations, evaluate
functions, etc.[ difficulty: round-off error]
Geometric problems
Deals with geometric objects such as points, lines and
polygon
E.g. Closest pair problem
Introduction
Introduction
11/13/2014
Introduction
Introduction
Algorithm classification
By types of problems: Study sorting algorithms, then
searching algorithms, etc.
By design technique: Study algorithms by design
strategy.
A general approach to solving problems
Examples of design strategies include:
Brute force
Divide-and-conquer
The greedy method
Dynamic programming
Introduction
Time : ?
11/13/2014
Introduction
Time: ?
Introduction