CSCE 411 Lecture 3

From Notes
Jump to navigation Jump to search
Lecture Slides

« previous | Friday, August 31, 2012 | next »


Time Complexity

We want to asymptotically count the number of operations independent of compilers and optimization settings.

Sad notation:

  • f=O(g)⟶f∈O(g)
  • O(f)=O(g)⟶O(f)⊆O(g)

Big-Oh

Let g:ℕ→ℂ be a function.

Then O(g) is the set of functions:

O(g)={f:ℕ→ℂ∣∃u>0 ∃n0∈ℕ ∀n≥n0 |f(n)|≤u|g(n)|}


Little-Oh

o(g)={f:ℕ→ℂ|limn→∞|f(n)||g(n)|=0}

It follows that o(f)⊆O(f)


Big-Ω

Ω(g)={f:ℕ→ℂ∣∃d>0 ∃n0∈ℕ ∀n≥n0 d|g(n)|≤|f(n)|}

Big-Θ

Θ(g)={f:ℕ→ℂ∣∃u,d>0 ∃n0∈ℕ ∀n≥n0 d|g(n)|≤|f(n)|≤u|g(n)|}


Corrected Proof of Sorting Lower Bound

2h≥n!log22h≥log2(n!)=log2(n(n−1)…(2)(1))h≥log2(n!)≥log2((n2)n2)h≥n2log2(n2)=n2log2n−n2log22h∈Ω(nlog⁡n)