CS 411 Fall 2025 > Outline for August 27, 2025
CS 411 Fall 2025
Outline
for August 27, 2025
Outline
Framework for Analysis of Algorithms [L 2.1]
- Efficiency & Complexity
  - An efficient algorithm uses relatively little of some limited resource.
- Complexity: measure of resources used.
- Time. So time efficiency or time complexity.
- Space. So space efficiency or space complexity. Memory used in addition to that for input & output.
 
- Measuring input size
  - Almost all algorithms run longer on larger inputs.
- Size: number of items in input list?
- Size: number of bits in input?
    - Representing positive integer \(k\) in binary requires \(1 + \lfloor \log_2 k\rfloor\) bits.
 
- For an \(n \times n\) matrix, size could be \(n\) or \(n^2\).
- This needs to be decided.
 
- Measuring time
  - Basic operation(s).
- It matters what we count!
 
- Order of growth
  - Idea: look at fastest growing term, ignore coefficients.
 
- Worst, best, average case
  - Worst case (we mean this unless we say otherwise).
- Best case. Little used.
- Average case: usually something like average over all possible inputs of a given size.
- Example of Sequential Search.
- Amortized efficiency: average over large number of consecutive executions of algorithm.