uiz Space

May 2025 term · Advanced Algorithms · BSCS4021

Advanced Algorithms Quiz 2: 3 August 2025 (May 2025 term)

The IIT Madras BS Advanced Algorithms (Advanced Algorithms) Quiz 2 paper sat on 3 Aug 2025, in the May 2025 term: 26 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
26
Marks
50
Duration
120 min
MCQ
24
Numerical
2

Updated

Official paper: IIT M IMPROVEMENT AN EXAM QIM2 03 Aug 2025 · No negative marking.

Question 1

+3 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

A graph G is a cluster graph if and only if it does not have an induced path on 3 vertices.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 2

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

Consider the following algorithm for finding a smallest-sized subset of vertices S⊆V(G)S \subseteq V(G) such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph. To begin with, let H=GH = G and S=∅S = \emptyset. While HH has an induced path on 3 vertices {u,v,w}\{u, v, w\},we update HH to H\{u,v,w}H \backslash \{u, v, w\} and SS to S∪{u,v,w}S \cup \{u, v, w\}.We repeat this process until HH has no induced path on 3 vertices. What can we say about kk, the size of the set SS output by this algorithm, relative to k⋆k^\star, the size of the optimal solution?

  1. A
  2. B
  3. C
Show answer

Correct answer

  • A

Question 3

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

In the DISJOINT CLUSTER VERTEX DELETION problem, if the subgraph induced on S is not a cluster graph, we can immediately return YES.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 4

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

In the DISJOINT CLUSTER VERTEX DELETION problem, if the subgraph induced on the vertices of S is not a cluster graph, we can immediately return NO.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 5

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

If the subgraph induced on the vertices of S is a cluster graph and a vertex in V (G) \ S is adjacent to at least two vertices in S which are in different cliques, then we can delete it and leave the parameter unchanged.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 6

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

If the subgraph induced on the vertices of S is a cluster graph and a vertex in V (G) \ S is adjacent to at least two vertices in S which are in different cliques, then we can delete it and decrease the parameter by 1.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 7

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

If the subgraph induced on the vertices of S is a cluster graph and a vertex in V (G) \ S is adjacent to some but not all vertices in a clique of G[S], then we can delete it and leave the parameter unchanged.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 8

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

If the subgraph induced on the vertices of S is a cluster graph and a vertex in V (G) \ S is adjacent to some but not all vertices in a clique of G[S], then we can delete it and decrease the parameter by 1.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 9

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

After modifying the input instance, we can solve DISJOINT CLUSTER VERTEX DELETION by solving a matching problem on a bipartite graph.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 10

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

DISJOINT CLUSTER VERTEX DELETION is polynomial time solvable.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 11

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

DISJOINT CLUSTER VERTEX DELETION is NP-hard.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 12

+2 marksOne correct option

A graph is called a cluster graph if and only if it is a disjoint union of cliques.

The CLUSTER VERTEX DELETION (CVD) problem is the following: Given an input graph GG and a parameter kk, does there exist a set SS of at most kk vertices of GG such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph.

In the DISJOINT CLUSTER VERTEX DELETION (DCVD) problem we are given an input graph GG, parameter kk and a set SS of vertices of GG of size k+1k+1 such that the subgraph induced on V(G)∖SV(G) \setminus S is a cluster graph and the subgraph G[S]G[S] is also a cluster graph. Our goal is to determine if there exists a subset T⊂V(G)T \subset V(G) of size at most kk which is disjoint from SS such that the subgraph induced on V(G)∖TV(G) \setminus T is a cluster graph.

Answer the given subquestions about CVD and DCVD.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 13

+2 marksOne correct option

Consider the following approximation algorithm for the weighted vertex cover problem.

1: Solve the relaxed linear program corresponding to the given problem:

Minimize∑i=1nweight(vi)⋅xiSubject toxi+xj≥1for all edges (vi,vj)∈E0≤xi≤1for 1≤i≤n\begin{aligned} &\text{Minimize} \quad && \textstyle\sum_{i=1}^{n} \mathit{weight}(v_i) \cdot x_i \\ &\text{Subject to} \quad && x_i + x_j \geq 1 \quad \text{for all edges } (v_i, v_j) \in E \\ & && 0 \leq x_i \leq 1 \quad \text{for } 1 \leq i \leq n \end{aligned}

2: C←{vi∈V:xi≥1/2}C \leftarrow \{v_i \in V : x_i \geq 1/2\}

3: return CC

Based on the above data, answer the given subquestions.

  1. A

    We still get a valid solution, and the algorithm remains a 2-approximation.

  2. B

    We still get a valid solution, and the algorithm becomes a 3-approximation.

  3. C

    We may no longer get a valid solution.

Show answer

Correct answer

  • B

    We still get a valid solution, and the algorithm becomes a 3-approximation.

Question 14

+2 marksOne correct option

Consider the following approximation algorithm for the weighted vertex cover problem.

1: Solve the relaxed linear program corresponding to the given problem:

Minimize∑i=1nweight(vi)⋅xiSubject toxi+xj≥1for all edges (vi,vj)∈E0≤xi≤1for 1≤i≤n\begin{aligned} &\text{Minimize} \quad && \textstyle\sum_{i=1}^{n} \mathit{weight}(v_i) \cdot x_i \\ &\text{Subject to} \quad && x_i + x_j \geq 1 \quad \text{for all edges } (v_i, v_j) \in E \\ & && 0 \leq x_i \leq 1 \quad \text{for } 1 \leq i \leq n \end{aligned}

2: C←{vi∈V:xi≥1/2}C \leftarrow \{v_i \in V : x_i \geq 1/2\}

3: return CC

Based on the above data, answer the given subquestions.

  1. A

    We still get a valid solution, and the algorithm remains a 2-approximation.

  2. B

    We still get a valid solution, and the algorithm becomes a (3/2)-approximation.

  3. C

    We may no longer get a valid solution.

Show answer

Correct answer

  • C

    We may no longer get a valid solution.

Question 15

+2 marksOne correct option

In Figure 1, we have a graph G and an FVS of size 3 which is given by the box, i.e., S ∶= {a,c,e}. We need to find a DISJOINT FVS of size 2.

For each of the given statements in the subquestions, determine if it is true or false.

According to the reduction rules for DFVS, Figure 2 shows a valid intermediate instance in the reduction with k= 2.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 16

+2 marksOne correct option

In Figure 1, we have a graph G and an FVS of size 3 which is given by the box, i.e., S ∶= {a,c,e}. We need to find a DISJOINT FVS of size 2.

For each of the given statements in the subquestions, determine if it is true or false.

According to the reduction rules for DFVS, Figure 3 shows a valid intermediate instance in the reduction with k= 2.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 17

+2 marksOne correct option

In Figure 1, we have a graph G and an FVS of size 3 which is given by the box, i.e., S ∶= {a,c,e}. We need to find a DISJOINT FVS of size 2.

For each of the given statements in the subquestions, determine if it is true or false.

According to the reduction rules for DFVS, Figure 4 shows a valid intermediate instance in the reduction with k= 2.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 18

+2 marksOne correct option

In Figure 1, we have a graph G and an FVS of size 3 which is given by the box, i.e., S ∶= {a,c,e}. We need to find a DISJOINT FVS of size 2.

For each of the given statements in the subquestions, determine if it is true or false.

According to the reduction rules for DFVS, Figure 5 shows a valid intermediate instance in the reduction with k= 2.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 19

+2 marksOne correct option

In Figure 1, we have a graph G and an FVS of size 3 which is given by the box, i.e., S ∶= {a,c,e}. We need to find a DISJOINT FVS of size 2.

For each of the given statements in the subquestions, determine if it is true or false.

According to the reduction rules for DFVS, Figure 4 shows a valid intermediate instance in the reduction with k= 1.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 20

+2 marksOne correct option

In Figure 1, we have a graph G and an FVS of size 3 which is given by the box, i.e., S ∶= {a,c,e}. We need to find a DISJOINT FVS of size 2.

For each of the given statements in the subquestions, determine if it is true or false.

The graph in Figure 1 has a FVS disjoint from S of size 2.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 21

+2 marksOne correct option

In Figure 1, we have a graph G and an FVS of size 3 which is given by the box, i.e., S ∶= {a,c,e}. We need to find a DISJOINT FVS of size 2.

For each of the given statements in the subquestions, determine if it is true or false.

The graph in Figure 1 has a FVS disjoint from S of size 1.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 22

+1 markOne correct option

Consider the task of counting how many sequences of length nn exist consisting only of numbers 00, 11, and 22 such that each number occurs at least once. We will solve this by calculating the number of sequences which do not contain at least one of the numbers.

Let's denote by AiA_i (i=0,1,2)(i = 0, 1, 2) the set of sequences in which the digit ii does not occur. The formula of inclusion-exclusion on the number of "bad" sequences is given by:

∣A0∪A1∪A2∣=∣A0∣+∣A1∣+∣A2∣−∣A0∩A1∣−∣A0∩A2∣−∣A1∩A2∣+∣A0∩A1∩A2∣|A_0 \cup A_1 \cup A_2| = |A_0| + |A_1| + |A_2| - |A_0 \cap A_1| - |A_0 \cap A_2| - |A_1 \cap A_2| + |A_0 \cap A_1 \cap A_2|

Based on the above data, answer the given subquestions.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 23

+1 markOne correct option

Consider the task of counting how many sequences of length nn exist consisting only of numbers 00, 11, and 22 such that each number occurs at least once. We will solve this by calculating the number of sequences which do not contain at least one of the numbers.

Let's denote by AiA_i (i=0,1,2)(i = 0, 1, 2) the set of sequences in which the digit ii does not occur. The formula of inclusion-exclusion on the number of "bad" sequences is given by:

∣A0∪A1∪A2∣=∣A0∣+∣A1∣+∣A2∣−∣A0∩A1∣−∣A0∩A2∣−∣A1∩A2∣+∣A0∩A1∩A2∣|A_0 \cup A_1 \cup A_2| = |A_0| + |A_1| + |A_2| - |A_0 \cap A_1| - |A_0 \cap A_2| - |A_1 \cap A_2| + |A_0 \cap A_1 \cap A_2|

Based on the above data, answer the given subquestions.

  1. A
  2. B

    —

  3. C
  4. D

    —

Show answer

Correct answer

  • C

Question 24

+1 markOne correct option

Consider the task of counting how many sequences of length nn exist consisting only of numbers 00, 11, and 22 such that each number occurs at least once. We will solve this by calculating the number of sequences which do not contain at least one of the numbers.

Let's denote by AiA_i (i=0,1,2)(i = 0, 1, 2) the set of sequences in which the digit ii does not occur. The formula of inclusion-exclusion on the number of "bad" sequences is given by:

∣A0∪A1∪A2∣=∣A0∣+∣A1∣+∣A2∣−∣A0∩A1∣−∣A0∩A2∣−∣A1∩A2∣+∣A0∩A1∩A2∣|A_0 \cup A_1 \cup A_2| = |A_0| + |A_1| + |A_2| - |A_0 \cap A_1| - |A_0 \cap A_2| - |A_1 \cap A_2| + |A_0 \cap A_1 \cap A_2|

Based on the above data, answer the given subquestions.

  1. A
  2. B
  3. C

    —

  4. D

    —

Show answer

Correct answer

  • D

    —

Question 25

+2 marksNumerical answer

Consider the task of counting how many sequences of length nn exist consisting only of numbers 00, 11, and 22 such that each number occurs at least once. We will solve this by calculating the number of sequences which do not contain at least one of the numbers.

Let's denote by AiA_i (i=0,1,2)(i = 0, 1, 2) the set of sequences in which the digit ii does not occur. The formula of inclusion-exclusion on the number of "bad" sequences is given by:

∣A0∪A1∪A2∣=∣A0∣+∣A1∣+∣A2∣−∣A0∩A1∣−∣A0∩A2∣−∣A1∩A2∣+∣A0∩A1∩A2∣|A_0 \cup A_1 \cup A_2| = |A_0| + |A_1| + |A_2| - |A_0 \cap A_1| - |A_0 \cap A_2| - |A_1 \cap A_2| + |A_0 \cap A_1 \cap A_2|

Based on the above data, answer the given subquestions.

For n= 4, calculate the number of sequences of length 4 consisting only of numbers 0, 1, and 2 such that each number occurs at least once.

Show answer

Correct answer: 36

Question 26

+2 marksNumerical answer

Consider the task of counting how many sequences of length nn exist consisting only of numbers 00, 11, and 22 such that each number occurs at least once. We will solve this by calculating the number of sequences which do not contain at least one of the numbers.

Let's denote by AiA_i (i=0,1,2)(i = 0, 1, 2) the set of sequences in which the digit ii does not occur. The formula of inclusion-exclusion on the number of "bad" sequences is given by:

∣A0∪A1∪A2∣=∣A0∣+∣A1∣+∣A2∣−∣A0∩A1∣−∣A0∩A2∣−∣A1∩A2∣+∣A0∩A1∩A2∣|A_0 \cup A_1 \cup A_2| = |A_0| + |A_1| + |A_2| - |A_0 \cap A_1| - |A_0 \cap A_2| - |A_1 \cap A_2| + |A_0 \cap A_1 \cap A_2|

Based on the above data, answer the given subquestions.

For n = 5, calculate the number of sequences of length 5 consisting only of numbers 0, 1, and 2 such that each number occurs at least once.

Show answer

Correct answer: 150