← 回題庫

卷別

資料結構與演算法

選擇

國立臺灣大學 2024 · 考試 · 第 6 題

考科演算法

(5 points) We want to multiply a sequence of matrices M1,…,MnM_1, \dots, M_n with the minimum number of multiplications. Since the matrix multiplication is associative, we can parenthesize the matrix multiplication in all possible orders. Let mi,jm_{i,j} be the minimum number of multiplications to multiply Mi,…,MjM_i, \dots, M_j. We can derive a recursion of mi,jm_{i,j}, where rir_i and cic_i are the numbers of rows and columns of the matrix MiM_i respectively.

m_{i,j} = \min_{i \le k < j} \left( m_{i,k} + m_{k+1,j} + r_i c_k c_j \right) \tag{1}

Now consider ms,s+km_{s,s+k}, 1<s<s+k<n1 < s < s+k < n. For given ss and kk, let xx be the number of mi,jm_{i,j}'s that have ms,s+km_{s,s+k} at the right-hand side of Equation 1, and let yy be the number of different mm's that are at the right-hand side of Equation 1 when i=si = s and j=s+kj = s+k. What is the approximate value of x+yx + y?

  • (A)
    s(n−k2)s \binom{n-k}{2}
  • (B)
    n+kn + k
  • (C)
    (n−s)(n−s−k)(n-s)(n-s-k)
  • (D)
    (k2)+(n2)\binom{k}{2} + \binom{n}{2}
  • (E)
    (n−k−s2)+(k2)\binom{n-k-s}{2} + \binom{k}{2}

標準解析

AI 已複查