Lecture 3mesuring Input
Lecture 3mesuring Input
Lecture 3mesuring Input
Lecture #3
Analysis of algorithms
Issues:
• correctness
• time efficiency
• space efficiency
• optimality
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
Worst case
Best case
Average case
Example
Exact formula
e.g., C(n) = n(n-1)/2
Example:
• How much faster will algorithm run on computer that is twice
as fast?