Skip to content
ExamRizzInterview readingReading
Leave

STEM · Computer Science · Foundational Concepts/Principles

Save

Computational Complexity (Big-O, P, NP)

Significance: Complexity theory classifies problems by resources required (time, space). Big-O notation describes growth rates. P (polynomial time), NP (nondeterministic polynomial), NP-complete (hardest in NP) classify problem difficulty. Determines what's tractable vs intractable. Guides algorithm design: finding O(n log n) vs O(n²) algorithm can mean difference between feasible and infeasible for large inputs.

Questions to think through

  1. Compare complexities: Algorithm A: O(n²), B: O(n log n), C: O(2ⁿ). For n=100: A=10,000, B≈700, C≈10³⁰ operations. Explain why: (a) for small n, constants matter more than growth rate (b) exponential overwhelms polynomial eventually (c) log factors significant in practice. Calculate crossover point where O(n log n) beats O(n²): solve n log n < n², i.e., log n < n. Always true for n > 1, but what about constants?

    explain
  2. Understand NP-completeness: Boolean SAT problem: given formula like (A ∨ B) ∧ (¬A ∨ C), find assignment satisfying it. This is NP-complete. Explain: (a) verifying solution is easy (O(n) to check assignment) (b) finding solution is hard (no known polynomial algorithm) (c) any NP problem reduces to SAT (Cook-Levin theorem). Why does this make SAT central to complexity theory?

    explain

Computational Complexity · Big-O Notation · P vs NP · NP-Complete · Algorithm Analysis · Asymptotic Growth