Professional Documents
Culture Documents
Lecture #3
Analysis of algorithms
b Issues:
• correctness
• time efficiency
• space efficiency
• optimality
b Approaches:
• theoretical analysis
• empirical analysis
Theoretical analysis of time efficiency
T(n) ≈ copC(n)
running time execution time Number of times
for basic operation basic operation is
executed
Empirical analysis of time efficiency
b Worst case
b Best case
b Average case
Example
b Exact formula
e.g., C(n) = n(n-1)/2
b Example:
• How much faster will algorithm run on computer that is twice
as fast?