Complexity cases

  • Best case: algorithm running with best set of data, fastest performance
  • Worst case: algorithm running with worst set of data, slowest performance
  • Average case: in-between
  • For algorithm analysis we want worst case

Big-O Notation

  • Denoted where is size of upper bound
  • Small bound that is not tight (precise):
  • Lower bound: $\Omega(f(n))$$
  • Mathematical definition:

Asymptotic Behaviour

Common Runtime Complexities

  • O(N): linear time
  • O(): quadratic time
    • NP-complete problems
      • Best known algorithm involves exponential time
      • Solve one in polynomial time -> solve all problems in that class
  • O(): exponential time
  • O()