- Asked 2/7
- 2072 Chaitra
- 2073 Chaitra
Define computational complexity
Short answer
Computational complexity studies the time and space resources an algorithm needs as a function of input size n. Time complexity T(n) is the max steps; space complexity S(n) is max tape cells. It classifies problems into classes like P (polynomial time), NP, PSPACE, EXPTIME. Complexity separates tractable problems (in P) from intractable ones.
Define computational complexity. (Write a short note on computational complexities.)
Computational complexity is the study of the resources (mostly time and memory space) that an algorithm or Turing machine needs to solve a problem, as a function of the input size n. It classifies problems by how hard they are to solve, not just by whether they are solvable.
Measures
- Time complexity T(n): the maximum number of steps (moves) a TM takes on any input of length n.
- Space complexity S(n): the maximum number of tape cells the TM uses on any input of length n.
Complexities are expressed in asymptotic notation, such as O(n), O(n²) and O(2ⁿ), and are usually studied for the worst case.
Complexity classes
| Class | Meaning |
|---|---|
| P | solvable by a deterministic TM in polynomial time, O(nᵏ) |
| NP | solvable by a non-deterministic TM in polynomial time (a solution can be verified in polynomial time) |
| PSPACE | solvable using polynomial space |
| EXPTIME | solvable by a deterministic TM in time for some polynomial p |
Known: P ⊆ NP ⊆ PSPACE ⊆ EXPTIME. Whether P = NP is an open problem.
Importance
Problems in P are called tractable (practical); problems that need exponential time are intractable for large n (for example the travelling salesman problem, as far as we know). Examples: sorting is O(n log n) (in P); SAT is in NP and is NP-complete.
Complexity theory separates problems that are merely hard from those that are undecidable, and it guides the choice between exact, approximate and heuristic algorithms.
✓ Answer checked by Claude Opus 5.5 (high effort)