vu

Notes for Vanderbilt University

View the Project on GitHub

Lecture 03-13-17

Selection

Finding element that is provably close to the median

Runtime analysis

Runtime analysis of T(n) <= cn + T(n/5) + T(7n/10)

  1. Induction
    • Instead proving T(n) <= 10cn
    • Basis: “really not a problem”
    • Inductive hypothesis
      • for all i < n, T(i) <= 10ci
    • Inductive step:
      • T(n) <= cn + 2cn + 7cn = 10cn
  2. Technique: Guess & prove
    • Think you should see it once
    • Figure out: I think it’s O(n)
    • cn + k(n / 5) + k(7n/10) <= kn
    • c + k/5 + k7/10 <= more math
    • c <= k/10
    • Show wrong guess example with mergesort

The Big-5 Algorithm