A triangulation of a polygon is a set of T chords that divide the polygon into disjoint triangles. Every triangulation of n-vertex convex polygon has _____ chords and divides the polygon into _____ triangles.
n – 3, n – 2
A chord of a convex polygon joins two non-adjacent vertices. Triangulating the polygon means adding non-crossing chords until every region is a triangle.
Step 1 — Angle sum: the interior angles of an n-vertex convex polygon add up to \((n - 2) \times 180^\circ\). Each triangle contributes exactly \(180^\circ\), and the triangles use exactly the polygon's angles, so there are n − 2 triangles.
Step 2 — Edge count: the triangles have \(3(n - 2)\) sides in total. The n polygon edges are each used once and each chord is shared by two triangles, so \(3(n - 2) = n + 2c\), giving \(c = n - 3\) chords.
Step 3 — Check with a quadrilateral (n = 4): one diagonal, two triangles, which fits n − 3 and n − 2.
Pairs such as n − 2 chords with n − 1 triangles, n − 1 with n, or n − 2 with n − 2 all overcount the chords, as the quadrilateral check shows.
n – 3, n – 2 option is correct.
Consider the problem of a chain <A1, A2, A3> of three matrices. Suppose that the dimensions of the matrices are 10 × 100, 100 × 5 and 5 × 50 respectively. There are two different ways of parenthesization : (i) ((A1 A2)A3) and (ii) (A1(A2 A3)). Computing the product according to the first parenthesization is ________ times faster in comparison to the second parenthesization.
Let \(n = 4\) and \((a_{1}, a_{2}, a_{3}, a_{4}) = (\text{do, if, int, while})\). Let \(p(1:4) = \left(\frac{3}{8}, \frac{3}{8}, \frac{1}{8}, \frac{1}{8}\right)\) and \(q(1:4) = \left(\frac{2}{8}, \frac{3}{8}, \frac{1}{8}, \frac{1}{8}, \frac{1}{8}\right)\) where p(i) and q(i) denotes the probability with which we search \(a_{i}\) and the identifier x being searched satisfy \(a_{i} \lt x \lt a_{i+1}\) respectively. The optimal search tree is given by :
Given two sequences X and Y :
\(X = \langle a, b, c, b, d, a, b \rangle\)
\(Y = \langle b, d, c, a, b, a \rangle\).
The longest common subsequence of X and Y is :
The travelling salesman problem can be solved in :
The minimum number of scalar multiplication required, for parenthesization of a matrix-chain product whose sequence of dimensions for four matrices is <5, 10, 3, 12, 5> is
Arrange the following steps in the correct order to solve the Knapsack problem using Dynamic Programming.
(A) Define the base case when the capacity is zero (0) or no items are left to consider
(B) Compute the maximum value that can be obtained using items up to the i-th item and a knapsack capacity of 0
(C) Identify subproblems and their dependencies based on items weights and values
(D) Initialize a table to store results of subproblems
(E) Iterate through each item and each possible Capacity to fill the table
Choose the correct answer from the options given below :
Consider the problem of a chain <A1, A2, A3> of three matrices. Suppose that the dimensions of the matrices are 10 × 100, 100 × 5 and 5 × 50 respectively. There are two different ways of parenthesization : (i) ((A1 A2)A3) and (ii) (A1(A2 A3)). Computing the product according to the first parenthesization is ________ times faster in comparison to the second parenthesization.
Let \(n = 4\) and \((a_{1}, a_{2}, a_{3}, a_{4}) = (\text{do, if, int, while})\). Let \(p(1:4) = \left(\frac{3}{8}, \frac{3}{8}, \frac{1}{8}, \frac{1}{8}\right)\) and \(q(1:4) = \left(\frac{2}{8}, \frac{3}{8}, \frac{1}{8}, \frac{1}{8}, \frac{1}{8}\right)\) where p(i) and q(i) denotes the probability with which we search \(a_{i}\) and the identifier x being searched satisfy \(a_{i} \lt x \lt a_{i+1}\) respectively. The optimal search tree is given by :
Given two sequences X and Y :
\(X = \langle a, b, c, b, d, a, b \rangle\)
\(Y = \langle b, d, c, a, b, a \rangle\).
The longest common subsequence of X and Y is :
The travelling salesman problem can be solved in :