Download presentation
Presentation is loading. Please wait.
Published byJustin Lester Modified over 9 years ago
1
BY Lecturer: Aisha Dawood
2
stands alone on the right-hand side of an equation (or inequality), example : n = O(n 2 ). means set membership :n ∈ O(n 2 ). when it appears in a formula, we interpret it as standing for some function that we do not care to name. For example, 2n 2 + 3n + 1 = 2n 2 + ( n). Left hand side and right hand side example : 2n 2 + ( n) = O(n 2 ). 2
3
the relational properties of real numbers apply to asymptotic comparisons as well. 3
4
4
5
For any two functions f(n) and g(n), we have f(n) = (g(n)), if and only if f(n) = O(g(n)) and f(n) = Ω (g(n)). Proof: left as a home work…. 5
6
Common expressions used to describe algorithm’s running time: 6 NameExpression Constant1, 2,…,c Logarithmiclog(n) Log squaredlog 2 (n) Linearn n log nn.log(n) Quadraticn2n2 Cubicn3n3 Exponential2n2n
7
7 (f(n)) describes f(n) f(n) = O(g(n)) and f(n) = Ω(g(n)). o(f(n) describes f(n) f(n) = O(g(n)) but not f(n) = Ω(g(n)). ω(f(n)) describes f(n) f(n) = Ω(g(n)) but not f(n) = O(g(n)).
8
Rule #1: Sequential composition: Worst case running time of a sequence : 8
9
Rule #2: Iteration: Worst case running time of an iteration: 9 For (S1) S2 S3. Sm O(T(n)) = MAX (O(T1(n)),O(T2(n)),...,O(Tm(n))) For (S1) S2 S3. Sm O(T(n)) = MAX (O(T1(n)),O(T2(n)),...,O(Tm(n)))
10
Rule #3: Conditional execution: Worst case running time of a conditional statement : 10
11
Determine a tight big-oh bound on the running time of a program to compute the series of sums S0, S1, S2..., Sn-1 where T(n) = O(n 2 ) 11
12
The Fibonacci numbers are the series of numbers F0,F1,F2... given by Consider the sequence of Fibonacci numbers T(n) = O(n) 12
13
we use the definition of Fibonacci numbers to implement directly a recursive algorithm 13
14
T(n) = Ω(Fn+1) By induction from the nature of the problem we get T(n) = Ω(2 n ) 14
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.