Given a convex n-gon made by connecting a point sequence in this order, a triangulation of the convex n-gon is a way of dividing its interior into triangles without overlap.
First, we count the number of triangulations of a convex n-gon. We denote the number as : For example, .
Answer the values of , , and .
Represent as a function of , , , ..., and . We define and .
The following pseudo-code implements an algorithm for computing for arbitrary . Answer the code that fills [ ① ]. Also answer the computational complexity (order) of the algorithm.
Next, we find the triangulation of a convex n-gon with a minimum cost. Here, the cost of a triangulation is defined as the sum of the cost of triangles in the triangulation, and the cost of a triangle is defined as the sum of the cost of the edges composing the triangle. Assume that all (), the costs of the edges connecting an arbitrary pair of vertices () of the n-gon, are given.
We consider solving the problem of finding a triangulation with a minimum cost by dividing the problem into subproblems. We denote as the cost of triangulating a polygon made by a path starting from , visiting vertices clockwise, and then coming back to (see the figure below). Assume that are all given for and . Represent as a function of and . We define . Also draw a figure explaining the situation.
Give approximately 10-line pseudo-code implementing an algorithm to compute the minimum cost of triangulating an arbitrary n-gon using the formula obtained in (4). Also answer the computational complexity (order) of the algorithm.
Basically, we choose an arbitrary triangle and using the fact all the other information is known. Then we look at the cost of the shape left of the triangle and right of it and combine with the cost of the triangle itself.
In this code we go over all possible divisions of the shape n-gon into 2 subshapes and compute the minimum for these with the addition of the dividing edge. This uses the formula acquired in (4).
The time complexity for this, assuming that the information is known as stated in (4) is .