NP (AI generated from transcript) Flashcards

1
Q

What does NP stand for in complexity theory?

A

Nondeterministic Polynomial time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: NP means ‘Not Polynomial’ time.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which complexity class is a subset of the other? A) P is a subset of NP B) NP is a subset of P

A

A) P is a subset of NP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If P = NP, which of the following is true? A) All NP-Complete problems can be solved in polynomial time B) No NP-Complete problems can be solved in polynomial time

A

A) All NP-Complete problems can be solved in polynomial time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

To prove a problem is in NP, what must be demonstrated?

A

That a proposed solution can be verified in polynomial time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

For a problem to be NP-Complete, which conditions must be satisfied? A) It is in NP B) All problems in NP reduce to it C) Both A and B D) Either A or B

A

C) Both A and B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

If problem A reduces to problem B, and B is in P, what can we conclude about A?

A

A is in P

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In a reduction from problem A to problem B, the reduction arrow points: A) From A to B B) From B to A

A

A) From A to B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

To verify a clique of size k in a graph with n vertices, the time complexity is:

A

O(n²)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In a reduction, which transformations must run in polynomial time?

A

Both input and output transformations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True or False: When showing an ‘if and only if’ relationship in a reduction proof, proving ‘if A has a solution then B has a solution’ and ‘if B has no solution then A has no solution’ is sufficient.

A

False

The statement mixes one direction (A → B) with the contrapositive of the other direction (¬B → ¬A).

Would be valid if “A -> B” and “B -> A”, or “A -> B” and “!A -> !B”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following problems is in P?
1. MST
2. Knapsack-search
3. k-Coloring
4. SAT

A

Minimum Spanning Tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When proving a graph problem is NP-Complete, which problems are typically best to reduce from?

A

Independent Set, Clique, or Vertex Cover

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The time complexity to verify a solution to the Subset Sum problem is:

A

O(n log W) where W is the sum of the integers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

True or False: In a reduction, we transform the input of the problem we’re proving is NP-Complete to the input of the known NP-Complete problem.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When reducing SAT to 3SAT, what is the main transformation technique?

A

Splitting clauses with more than three literals by introducing new variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

The contrapositive of ‘If P then Q’ is:

A

If not Q then not P

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Which statement about NP-Hard problems is correct?
1. All NP Hard problems are NP-Complete
2. All NP-Hard problems are in NP
3. NP Hard can be verified in polynomial time
4. Not all NP-Hard problems are in NP

A

Not all NP-Hard problems are in NP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

In the reduction from 3SAT to Independent Set, the goal value g is set to:

A

The number of clauses in the 3SAT formula

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

In the reduction from Independent Set to Vertex Cover, how is the budget b determined?

A

b = n - g (where n is the number of vertices)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

True or False: In the reduction from Independent Set to Clique, we use the complement of the original graph.

A

True

Complement Graph:
The complement of a graph is a graph with the same vertices, but where an edge exists between two vertices if and only if it did not exist in the original graph

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

In the reduction from 3SAT to Subset Sum, what number base is used to avoid carries between digits?

A

Base 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Which of the following is NOT in NP?

A

Maximum Independent Set (optimization version)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

The time complexity to verify a Vertex Cover solution is:

(Given a candidate solution for VC of vertex set S and input graph G=(V,E), check that for all edges (x,y) in E, at least x or y is in vertex set S.)

A

O(n + m) where n is vertices and m is edges

Given n vertices in V and m edges in E, this check takes O(n+m). We then check that size of S is at most budget b by counting the number of vertices in S. Counting all vertices takes O(n) time. O(n+m) dominates and is polynomial.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

True or False: If problem A reduces to problem B, then A is computationally at least as hard as B.

A

False (B is at least as hard as A)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

When reducing from SAT, which variant is typically more convenient to use?

A

3SAT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

In a reduction from problem A to problem B, if B has a solution, what can we conclude about A?

A

A has a solution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Most egregious error in NP-Completeness proofs

A

Reducing from the unknown problem to a known NP-Complete problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

True or False: When verifying a solution for a problem is in NP, the verification runtime can depend on the goal/budget parameter.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Which pair of statements proves the ‘if and only if’ relationship in a correctness proof?

A

‘If A has a solution, then B has a solution’ AND ‘If B has a solution, then A has a solution’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

The runtime of a verification algorithm for an NP problem must be:

A

Polynomial in the input size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

True or False: In a reduction, the input transformation must maintain the same problem size.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

In the reduction from 3SAT to Independent Set, what edges are added between literals of different clauses of same variables?

A

Edges between a literal and its negation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

True or False: A problem can be NP-Hard without being in NP.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

The runtime of verifying a solution to 3SAT with n variables and m clauses is:

A

O(m)

Given assignments S, check that each clause in C has at least 1 satisfied literal. Since each clause has at most 3 literals, it takes O(1) to check each clause, and there are m clauses so it’d take O(m) time which is polynomial.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

True or False: The Knapsack search problem is NP-Complete.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

Which is the correct relationship? A) P ⊆ NP B) NP ⊆ P

A

A) P ⊆ NP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

For the Subset Sum problem with n integers and target sum t, the dynamic programming algorithm runtime is:

A

O(nt)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

True or False: The decision version of optimization problems is typically used in NP-Completeness proofs.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

In the reduction from 3SAT to Subset Sum, what are ‘buffer numbers’ used for?

A

To adjust the sum to the target when not all literals in a clause are satisfied

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

True or False: Max Independent Set is NP-Complete.

A

False (it’s NP-Hard but not in NP)

42
Q

In the reduction from Independent Set to Vertex Cover, if S is a vertex cover, what is its relationship to the independent set?

A

The complement of S is an independent set

43
Q

Which problem is typically used to prove Knapsack is NP-Complete?

A

Subset Sum

44
Q

True or False: The SAT problem remains NP-Complete when restricted to formulas where each literal appears at most twice.

45
Q

What property must a reduction from problem A to problem B maintain for correctness?

A

If and only if A has a solution, B has a solution

46
Q

In CNF formulas, clauses are connected by which operator?

47
Q

In the Kite problem, what defines a kite in a graph with 2n vertices?

A

n vertices form a clique and n vertices form a path connected to the clique

48
Q

True or False: In the reduction from 3SAT to Independent Set, each clause is represented as a complete subgraph.

49
Q

Which of the following correctly describes the relationship between P, NP, and NP-Complete?

A

NP-Complete = NP ∩ NP-Hard

50
Q

The time complexity for verifying a solution to the Subgraph Isomorphism problem is:

For a pair of graph G=(V,E) and H=(V’,E’) Let π be the mapping from V to V’. First, traverse graph G. For each vertex v ∈ V, check if π(v)=v’ exists in H. For each edge (v, u) adjacent to v, check all edges adjacent to v’ to find (v’, u’).

A

O((n+m)m’)

Traversing G takes O(n+m). For each edge we have m’ edges (of size E’) to check. This results in O(n+m * m’) which is polynomial.

51
Q

In a reduction from Independent Set to Clique+IS, why is the goal set to k+1 instead of k?

A

By adding a new vertex and connecting it to the clique, we ensure that the transformed graph G’ has a clique of size k+1, and the original independent set (if it exists) remains an independent set of size k, thus satisfying the conditions of the Clique+IS problem

52
Q

True or False: An algorithm with runtime O(nW), where W is an input parameter, is a polynomial time algorithm.

A

False (it’s pseudo-polynomial)

53
Q

Which of the following is NOT a constraint in AtMost-3SAT?

A

Each variable must appear at least once

54
Q

In reduction by generalization, what is the approach?

A

Showing that the new problem is a more general case of a known NP-Complete problem

55
Q

True or False: Every NP-Complete problem reduces to every other NP-Complete problem.

56
Q

The input size for Subset Sum problem with n integers up to value t is:

A

O(n log t)

57
Q

In the reduction from SAT to 3SAT, how many new variables are needed for a clause with k literals?

58
Q

True or False: In the reduction from Vertex Cover to Hitting Set, each edge becomes a set in the Hitting Set instance.

59
Q

Which of the following is NOT a valid way to prove the ‘if and only if’ correctness?

A

If A has a solution then B has a solution, and if A has a solution then B has no solution

60
Q

In the reduction from 3SAT to Independent Set, the number of vertices in the resulting graph is:

A

At most 3m (where m is the number of clauses)

61
Q

True or False: When reducing from 3SAT to Subset Sum, the target sum has a digit pattern that corresponds to variables and clauses.

62
Q

The relationship between CLIQUE and INDEPENDENT SET is:

A

A set S is a clique in G if and only if S is an independent set in the complement of G (G-bar)

63
Q

In the EXACT 4SAT problem, what is the constraint on clauses?

A

Each clause has exactly 4 literals

64
Q

True or False: A solution to the Subset Sum problem can be verified in O(n log t) time.

65
Q

In the reduction from Subset Sum to Knapsack, how are the weights and values related?

A

Weights and values are equal to the integers in the Subset Sum instance

66
Q

Which of the following is NOT a verification step for the Kite problem?

A

Checking if the graph has a Hamiltonian cycle

67
Q

True or False: The reduction from SAT to 3SAT creates at most O(nm) new clauses.

A

True

Let C=a1​…an​ be input to I to SAT, and c′∈C′ be clauses in our input to 3SAT. For each c′∈C′, if c’ has at most 3 literals, add c as clause c’ to C’. If c has greater than 3 literals, create c’ as follows: create k-3 new variables as y1​,y2​…yk−3​. Using these variables create C′=(a1​,a2​,y1​)∧(yˉ​1​,a3​,y2​)…(yˉ​k−4​,ak−2​,yk−3​)∧(yk−3​,ak−1​,ak​). There are m clauses with at most n literals so takes O(nm) which is polynomial.

68
Q

Which statement about the converse of ‘If P then Q’ is correct?

A

The converse ‘If Q then P’ is not logically equivalent to the original statement

69
Q

In gadget construction for reductions, what is the purpose of a gadget?

A

To transform one problem instance into another while preserving solution properties

70
Q

True or False: The runtime of a verification algorithm can depend on the magnitude of input values.

71
Q

In the reduction from 3SAT to Independent Set, what ensures that no contradictory variable assignments are made?

A

Adding edges between vertices representing a variable and its negation

72
Q

The number of different ways to prove an ‘if and only if’ relationship is:

73
Q

True or False: In the reduction from 3SAT to Subset Sum, the transformation creates O(nm) numbers.

74
Q

Which of the following problems would be best to reduce from when proving Vertex Cover is NP-Complete?

A

Independent Set

75
Q

In the context of NP-Completeness, what does a subgraph need to satisfy compared to an induced subgraph?

A

A subgraph can omit edges between its vertices that exist in the original graph

76
Q

True or False: In the reduction from Independent Set to Clique, isolated vertices become connected to all other vertices in the complement graph.

A

True

Given input G=(V,E) and goal g as input to IS, modify it to create a complementary graph (G’). Given G, we invert it by checking for all pairs x,y in V whether (x,y) is in E. If (x,y) is in E, remove this edge and if (x,y) is not in E, we add a new edge.

Given n vertices, this operation takes O(n^2). Set goal g for Clique equal to IS goal g. This takes O(1) time. Pass the G’ and goal g to Clique. Runtime is dominated by O(n^2) and polynomial in time.

77
Q

Which is NOT a valid statement about NP-Completeness?

A

If a problem is NP-Complete, there must be no polynomial time algorithm for it

78
Q

In SAT, literals within a clause are connected by which operator?

79
Q

True or False: The Clique problem restricted to graphs where every vertex has degree at most 3 is in P.

A

True

DPV shows it can be solved checking all combinations of 3 vertices

80
Q

When reducing from a known NP-Complete problem A to an unknown problem B, what is the correct statement about their relative hardness?

A

B is at least as hard as A

81
Q

In the reduction from 3SAT to Subset Sum, what happens if a clause has no satisfied literals?

A

The corresponding digit cannot sum to the target value

82
Q

For the Vertex Cover problem, what is search component

A

Finding a vertex cover at most budget b

83
Q

In the reduction from Clique to Kite, what structure is added to the original graph?

A

A path connected to each vertex

84
Q

True or False: Cook-Levin theorem established that SAT is NP-Complete.

85
Q

The NotAllEqual-3SAT problem differs from 3SAT by requiring:

A

Each clause must have at least one true literal and at least one false literal

86
Q

Which reduction technique is used when transforming an optimization problem to a decision problem?

A

Adding a budget/goal parameter

87
Q

True or False: In proving a problem is NP-Complete, it’s sufficient to show that the known NP-Complete problem reduces to it.

88
Q

When a problem has a dynamic programming solution with runtime O(nW), it is:

A

Pseudo-polynomial, not necessarily polynomial

89
Q

In the context of NP-Completeness, what does ‘polynomial’ refer to?

A

Runtime that is polynomial in the input size

90
Q

True or False: Exact-4SAT is NP-Complete.

91
Q

If we have a polynomial time algorithm for an NP-Complete problem, what can we conclude?

92
Q

In the reduction from Independent Set to Vertex Cover, the runtime of the input transformation is:

A

O(1)

set b = n - g

93
Q

True or False: Knapsack with inputs given in unary is in P.

94
Q

The purpose of ‘variable edges’ in the 3SAT to Independent Set reduction is:

A

To prevent selecting both a variable and its negation

95
Q

NP-Hard key fact

A

NP-Hard problems are at least as hard as any problem in NP

96
Q

True or False: If a problem is in P, it must also be in NP.

97
Q

In the reduction from SAT to 3SAT, how many new clauses replace a clause with k literals?

98
Q

What does the ‘completeness’ in NP-Complete signify?

A

The problem is both in NP and NP-Hard

99
Q

True or False: STINGY SAT (finding a satisfying assignment with at most k true variables) is NP-Complete.

100
Q

If problem A reduces to problem B and problem B reduces to problem C, what can we conclude?

A

Problem A reduces to problem C