Lecture21 PDF
Lecture21 PDF
Lecture21 PDF
1
Relating O and Ω
2
Properties of the relations O, Ω, and Θ
3
Analyzing algorithms
4
Bubble sorting again
• Notice that the bubble sort algorithm always takes this number of steps. on
any size n array.
• Therefore the complexity is Θ(n2).
5
Merge sort
6
Euclid’s GCD algorithm
7
An O-estimate for Euclid
2 3 5 8
8
What’s a really hard problem?
9
Understanding exponential versus polynomial complexity
10
The Satisfiability Problem
11
Are there problems that are “super-exponential”?
n
• Yes, there are problems for which all algorithms are Ω(22 ), for example.
But the situation is even more dismal; there are problems for which no
algorithm exists whatsoever! These are called “undecidable problems”.
• An example of such a problem is the “satisfiability problem in predicate
calculus”. Given a sentence (no free variables) of predicate calculus, is
that sentence true in some universe of discourse?
• Even in the universe of natural numbers, there is no algorithm which will
tell if a sentence about them is true.
• No algorithm at all will correctly answer all questions of this type.
• This means that there are still jobs for mathematicians. They cannot be
replaced by computers.
12
How do you prove that there isn’t any algorithm to solve a problem?
13