Algorithm Analysis
Learning Objectives
- Evaluate algorithm efficiency using Big O notation.
- Compare alternative approaches logically.
- Explain time/space trade-offs clearly.
Core Concepts
- Time Complexity: growth of execution steps.
- Space Complexity: extra memory needed.
- Best/Average/Worst case behavior.
Quick Examples
- Array index access: O(1)
- Linear search: O(n)
- Binary search (sorted): O(log n)
- Nested full scan: O(n^2)
Analysis Workflow
- Count dominant operations.
- Express growth with Big O.
- Compare candidates for same problem.
- Validate with real input sizes.
Summary
Good analysis prevents expensive design mistakes early.