Design and Analysis of Algorithms
Chapter 11
How to tackle those difficult problems.
Exact solutions
There are two principal approaches to tackling NP-hard
NPproblems or other intractable problems:
Th
Design and Analysis of Algorithms
Our old list of problems
Classifying a problems complexity
Sorting
Searching
Shortest paths in a graph
Minimum spanning tree
Primality testing
Traveling salesman prob
Design and Analysis of Algorithms
Dynamic Programming
Dynamic Programming is a general algorithm design technique Invented by American mathematician Richard Bellman in the 1950s to solve optimization
Design and Analysis of Algorithms
Greedy algorithms
Chapter 9
Applications of the Greedy Strategy
Optimization problems solved through a sequence of choices
that are:
feasible
Optimal solutions:
local
Design and Analysis of Algorithms
Chapter 7
SpaceSpace-time tradeoffs
String matching
For many problems some extra space really pays off:
? extra space in tables (breathing room?)
hashing
non compar
Design and Analysis of Algorithms
Decrease and Conquer
1.
2.
3.
Chapter 5
Examples of Decrease and Conquer
Reduce problem instance to smaller instance of the same
problem and extend solution
Solve sma
Design and Analysis of Algorithms
Transform and Conquer
Chapter 6
Instance simplification - Presorting
Solve problem by transforming into:
? a more convenient instance of the same problem (instance im
Design and Analysis of Algorithms
Analysis of Algorithms
Theoretical analysis of time efficiency
Time efficiency is analyzed by determining the number of
repetitions of the basic operation as a functi
Design and Analysis of Algorithms
Divide and Conquer
Chapter 4
Divide-and-conquer technique
Divide- and-
The most well known algorithm design strategy:
1.
Divide instance of problem into two or more s
Design and Analysis of Algorithms
Brute Force
String matching
A straightforward approach usually based on problem
statement and definitions
Examples:
1.
Computing an (a > 0, n a nonnegative integer)
2
Design and Analysis of Algorithms
Algorithm
Chapter 1
Historical Perspective
Euclids algorithm for finding the greatest common divisor
An algorithm is a sequence of unambiguous
instructions for solvin
How to tackle those difficult
problems.
There are two principal approaches to tackling NP-hard
problems or other intractable problems:
Use a strategy that guarantees solving the problem exactly
but do
Our old list of problems
Sorting
Searching
Shortest paths in a graph
Minimum spanning tree
Primality testing
Traveling salesman problem
Knapsack problem
Chess
Towers of Hanoi
Program termination
Desig
Transform and Conquer
Solve problem by transforming into:
a more convenient instance of the same problem (instance implification)
presorting
Gaussian elimination
a different representation of the sa
Decrease and Conquer
1.
2.
3.
Reduce problem instance to smaller instance of the same
problem and extend solution
Solve smaller instance
Extend solution of smaller instance to obtain solution to
origi
Greedy algorithms
Optimization problems solved through a sequence of choices
that are:
feasible
locally optimal
irrevocable
Not all optimization problems can be approached in this
manner!
Design and A
Divide and Conquer
The most well known algorithm design strategy:
1.
Divide instance of problem into two or more smaller
instances
2.
Solve smaller instances recursively
3.
Obtain solution to original
Dynamic Programming
Dynamic Programming is a general algorithm design
technique
Invented by American mathematician Richard Bellman in
the 1950s to solve optimization problems
Programming here means
Analysis of Algorithms
Issues:
Correctness
Time efficiency
Space efficiency
Optimality
Approaches:
Theoretical analysis
Empirical analysis
Design and Analysis of Algorithms - Chapter 2
1
Theoretical
Brute Force
A straightforward approach usually based on problem
statement and definitions
Examples:
1.
Computing an (a > 0, n a nonnegative integer)
2.
3.
Computing n!
Multiply two n by n matrices
4.
Space-time tradeoffs
For many problems some extra space really pays off:
extra space in tables (breathing room?)
hashing
non comparison-based sorting
input enhancement
indexing schemes (eg, B-trees
Algorithm
An algorithm is 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.
Design and Analysis o
Chapter 1
Preliminaries
Chapter 2
Evolution of the
Major
Programming
Languages
Chapter 3
Describing Syntax
and Semantics
Chapter 4
Lexical and
Syntax
Analysis
Chapter 6
Data Types
Chapter 9
Subprogram