Randomized Algorithms

  • If algorithm has better Average-Case Run-Time than worst-case time, then we randomize it.
  • Randomized Algorithms is one which relies on some random input in addion to the input.
  • Goal: shift dependency of run-time from what we can’t control (input) to what we can control (random numbers).

Example:

  • random(2) = 1 → swap and
  • random(2) = 0 → don’t
  • Observe:

  • random choices