Numerical Computation - Lec - 4 - Part 1 PDF
Numerical Computation - Lec - 4 - Part 1 PDF
Computation
Lecture 4 (Part1)
3/18
Types of Analysis
Worst Case
Provides an upper bound on running time
An absolute guarantee that the algorithm would not run longer, no matter what the inputs are
best Case
Provides a lower bound on running time
Input is the one for which the algorithm runs the fastest
Average case
Provides a prediction about the running time
Assumes that the input is random
Ideal Solution
7/18
Asymptotic Notation(cont.)
8/18
Asymptotic Notation(cont.)
9/18
Asymptotic Notation(cont.)
10/18
Asymptotic Notation(cont.)
11/18
Asymptotic Notation(cont.)
12/18
Asymptotic Notation(cont.)
(Ex. 1)
(Ex. 2)
13/18
Properties of Asymptotic Notation
Transitivity:
Reflexivity:
Symmetry:
Transpose symmetry:
14/18
Logarithms
logk n (log n ) k
Binary logarithm lg n log2 n log log n log(logn )
Natural logarithm ln n loge n log x y y log x
log xy log x log y
x
log log x log y
y
loga x loga b logb x
a logb x x logb a 15/18
Recurrences
Recurrence: an equation that describes a function in terms of its
value on smaller
c n 1
The expression T ( n)
2T n cn n 1
2
is a recurrence 16/18
Recurrences Examples
0 n0 0 n0
s ( n) s ( n)
c s (n 1) n 0 n s (n 1) n 0
c n 1 c n 1
T ( n) T ( n)
2T c n 1
n n
aT cn n 1
2 b
17/18
Solving Recurrences
Three methods for solving recurrences
Substitution Method
Recursion-tree Method
Master Method
18/18
Lec.5: Growth of
Functions (Part 2)
Thank
you!