Design & Analysis of Algorithm
Design & Analysis of Algorithm
Algorithm
Course Objectives
Algorithms are the core subject in
computer science when it comes to
problem solving by computers.
The main objective of this undergraduate
level course is to introduce students to the
crux of algorithm design, evaluation and
implementation.
Famous computer science problems will
be discussed and various approaches to
the solution would be compared.
This course
About performance!
Because, performance is the line between feasible
and unfeasible.
E.g.if not fast enough, can not be adopted (fast web
search)
1. Design
Create data structures & algorithms to solve problems.
Decision problems
Is an integer prime?
Is a graph planar? (Can be drawn on a plane without overlapping edges?)
Also called an instance of the problem.
Three Kinds of Problems: 2
Function problems
Search problems
Time efficiency
As a function of its input size, how long does it take?
Space efficiency
As a function of its worst-
Especially, input &size, how much
average-case additional
asymptotic space does it use?
efficiency.
Properties of Algorithms: 2
Simplicity
Informal notion
Easier to code correctly
Lower constant factors in time efficiency (typically)
Easier to explain
Easier to prove correct (probably)
More mathematically “elegant”
Ideal algorithm?
1. Correctness
2. Amount of work done
3. Amount of space used
4. Simplicity, clarity
5. Optimality
(In 2001)
Another Example
Sys. A executes 1 billion instructions per second
Sys. B executes 10 million instructions per second
A uses insertion sort with 2n2 steps
B uses merge sort with 50n log(n) steps
How much time do they take when n = 1 million?
https://www.coursera.org/course/algs4partI
https://www.coursera.org/course/algs4partII
Stanford University
https://www.coursera.org/course/algo