Module 5 of daa
Module 5 of daa
Approximation algorithm
Key Concepts
Examples
Randomized algorithm
A randomized algorithm is an algorithm that uses randomness (typically through random
number generation) as part of its logic. Unlike deterministic algorithms, randomized algorithms
can produce different outputs or follow different paths on different runs, even with the same
input.
The NP vs P question is central in computational complexity, but there are classes of problems
beyond NP and P — meaning they're harder or more general than problems that can be solved
or verified in polynomial time. Here's a structured look at some of these broader classes:
🔹 1. PSPACE (Polynomial Space)
🔹 4. Undecidable Problems
Definition: Problems not solvable by any algorithm, no matter how much time or space
you allow.
Example: Halting Problem — determining whether an arbitrary program halts.
These are beyond even EXPSPACE.
A problem beyond both P and NP typically falls into a harder complexity class such as
PSPACE, EXPTIME, or even undecidable problems. Here's one well-known and illustrative
example in each of these "beyond NP and P" categories:
∃x1∀x2∃x3…ϕ(x1,x2,x3,… )\exists x_1 \forall x_2 \exists x_3 \dots \phi(x_1, x_2, x_3,
\dots)
Complexity: PSPACE-complete.
Why beyond NP?: NP can only handle existential quantifiers (like in SAT). But QBF
mixes existential and universal quantifiers, which is much more powerful and
complex.
Application: Used in AI (e.g., game solving), formal verification, and logic.
Problem: Given a program and input, will the program eventually halt or run forever?
Complexity: Undecidable — not solvable by any Turing machine.
Why beyond everything?: There is no algorithm that can solve this problem in general.
Summary Table