Answer
Option (a)
Work Step by Step
Class P: Problems that can be solved by a deterministic algorithm in polynomial time.
Class NP: Problems for which a solution can be verified in polynomial time, but not necessarily found in polynomial time.
Many famous NP problems are not known to be in P (and are believed not to be).
a. For a given set S of n integers, sort S.
- Sorting can be done efficiently by algorithms like Merge Sort, Heap Sort, or Quick Sort, all of which run in $O(\log n)$ time.
- Polynomial time → in class P.
b. The Traveling Salesperson Problem (TSP).
- Given a set of cities and distances, find the shortest possible tour that visits each city once and returns to the start.
- Brute-force: $O(n!)$ possibilities — exponential.
- No known polynomial-time algorithm for the general case.
$\rightarrow$ Not in P (it’s NP-hard / NP-complete).
c. The Hamilton Path problem.
- Determine whether a graph contains a path that visits every vertex exactly once.
- This is a classic NP-complete problem (decision version).
$\rightarrow$ Not in P (unless P = NP).
d. The Node (Vertex) Cover problem.
- Given a graph and an integer $𝑘$, decide whether there’s a subset of $k$ vertices that covers all edges.
- Another classic NP-complete problem.
$\rightarrow$ Not in P (unless P = NP).
Therefore: Only (a) is in class P.