2020

Question 7

Let be an array of size , whose elements are different integers ranging from to . Let be the number of all possible distinct arrays each of which can be created by iteratively applying the following operation to , or more times.

Operation: choose arbitrary that satisfies and , and swap the values of and .

We denote the largest number in array by , and the smallest number by .

  1. Let . Show for , respectively.

  2. When , prove . Here, denotes an array that is array with element removed.

  3. When , prove . Here, we define .

  4. Show an algorithm that computes from using (2) and (3).

  5. Let . We define as the worst time complexity of the algorithm you showed in (4). Write in terms of , and prove it. You can assume that addition, comparison, copy of two elements take unit time.

  6. Let . Assuming that the possible permutations have equal probability of being generated as the input array, write the average time complexity of the algorithm you showed in (4).


为一个大小为 的数组,其元素为 范围内的不同整数。设 为可以通过对 进行 次或多次以下操作创建的所有可能不同数组的数量。

操作:选择满足 的任意 ,交换 的值。

我们将数组 中的最大数记为 ,最小数记为

  1. 。分别显示 时的

  2. 时,证明 。这里, 表示从数组 中移除元素 后的数组。

  3. 时,证明 。这里,我们定义

  4. 使用 (2) 和 (3) 展示一个从 计算 的算法。

  5. 。我们定义 为你在 (4) 中展示的算法的最坏时间复杂度。用 表示 ,并证明它。你可以假设两个元素的加法、比较、复制操作的时间为一个单位时间。

  6. 。假设 个可能的排列作为输入数组被生成的概率相等,写出你在 (4) 中展示的算法的平均时间复杂度。


Question 8

Assume that the following equation holds for square matrices, , and :

Assume that , is the inverse matrix of , , and if .

Solve the following problems.

  1. Show the inverse matrix for each of and .

  2. Show that is one of the eigenvalues of , and show one of the corresponding eigenvectors of .

  3. Suppose that is a positive integer. Show every pair of eigenvalue and corresponding eigenvector of .


假设对于 的方阵 ,以下等式成立:

假设 的逆矩阵,,且当

解决以下问题。

  1. 展示 的逆矩阵。

  2. 证明 的一个特征值,并展示 的一个对应特征向量。

  3. 假设 是一个正整数。展示 的每对特征值和对应特征向量。


Question 9

Answer the following problems about undirected graphs.

  1. Prove that the sum of degrees of all vertices of an undirected graph is even.

  2. Chemical formula corresponds to several structural isomers. Show all isomers as graphs. The following graph represents .

	H
	|
H - C - H
    |
    H
  1. Three servers are connected as in the graph below. The network is functional when the graph is connected. Each edge disconnects independently with probability . Find the probability of the network being functional as a function of .
O
|\
| \
|  \
O---O

回答以下关于无向图的问题。

  1. 证明无向图中所有顶点度数之和是偶数。

  2. 化学式 对应于几种结构异构体。将所有异构体表示为图。以下图表示

	H
	|
H - C - H
    |
    H
  1. 三台服务器按下图连接。当图是连通时,网络是功能性的。每条边以概率 独立断开。找到网络作为 的函数是功能性的概率。
O
|\
| \
|  \
O---O

Question 10

Let be an array of real numbers. We call a heap if for , where is the integer quotient of divided by 2. Answer the following questions.

  1. Give an algorithm that makes a heap in worst-case time.

  2. If is a heap, prove that is the maximum element.

  3. Using the notion of heap, describe an algorithm that sorts an arbitrary array in worst-case time.


为一个包含 个实数的数组。如果 满足 ,其中 ,且 除以 2 的整数商,则称 为堆。回答以下问题。

  1. 给出一个使 在最坏情况下时间复杂度为 的堆化算法。

  2. 如果 是一个堆,证明 是最大元素。

  3. 使用堆的概念,描述一个在最坏情况下时间复杂度为 的排序任意数组 的算法。


Question 11

Machine A produces a sequence with the following output probability .

Output probabilities: for , .

Machine B produces a sequence by a stationary first-order Markov model with the following initial probabilities and transition probabilities .

Initial Probabilities: for .

Transition Probabilities: for , .

Machine C converts each occurrence of ac in an input sequence independently to gt with probability .

Assume that is the probability that is true, and that is the conditional probability that is true when is true. Assume also that is the probability that Machine A outputs a sequence , and is the probability that Machine B outputs a sequence .

Solve the following problems. For (2) to (4), you can use and by substituting with any concrete sequence (, for example) as they are.

  1. When , show the four probabilities, , , , .
  2. When , three sequences from Machine A and two sequences from Machine B were produced. When a sequence is selected randomly from those five sequences, it was actgt. Show the probability that this sequence was one of the three sequences produced from Machine A.
  3. When , show the probability that the output sequence of Machine C is actgt when the input of Machine C was an output of Machine A.
  4. Five sequences were produced in the same manner as (2), and two sequences were randomly selected from the five sequences. When one of the selected two sequences was used as the input of Machine C, both the output sequence of Machine C and the remaining sequence were actgt. Show the probability that those two sequences were originally produced from the same machine (Machine A or Machine B).

机器 A 产生一个序列 ,其输出概率为

输出概率:,其中

机器 B 通过一个固定的一阶马尔可夫模型产生一个序列 ,其初始概率 和转移概率 如下。

初始概率:,其中

转移概率:,其中

机器 C 将输入序列中的每次出现的 ac 独立地以概率 转换为 gt

假设 为真的概率, 为真时 为真的条件概率。同样假设 是机器 A 输出序列 的概率, 是机器 B 输出序列 的概率。

解决以下问题。从 (2) 到 (4),你可以直接使用 ,用任何具体序列(例如 )代替

  1. 时,展示四个概率
  2. 时,机器 A 产生三个序列,机器 B 产生两个序列。当从这五个序列中随机选择一个序列时,它是 actgt。展示该序列是从机器 A 产生的三个序列之一的概率。
  3. 时,展示当机器 C 的输入是机器 A 的输出时,机器 C 的输出序列是 actgt 的概率。
  4. 按照 (2) 的方式产生五个序列,随机从这五个序列中选择两个序列。当选定的两个序列之一被用作机器 C 的输入时,机器 C 的输出序列和剩余的序列都是 actgt。展示这两个序列最初是由同一台机器(机器 A 或机器 B)产生的概率。

Question 12

For a mouse aging experiment, we need to pair male and female mice, with these rules:

  • Each mouse can match at most one other mouse.
  • Each match must be between opposite genders.
  • A female can only match a younger male.

Assume that no two mice have exactly the same age. We have a list of mice, numbered from 1 to in order of increasing age.

is the number of males among the first mice.

is the number of ways of making matches among the first mice.

Let (i 1).

  1. What is when ?
  2. Suppose we have already made matches among the first mice, and . How many remaining ways are there of matching the -th mouse?
  3. Write a formula for in terms of and .

在一项小鼠衰老实验中,我们需要为雄性和雌性小鼠配对,规则如下:

  • 每只小鼠最多只能与另一只小鼠匹配。
  • 每次匹配必须是异性之间的匹配。
  • 雌性只能与比自己年轻的雄性匹配。

假设没有两只小鼠年龄完全相同。我们有一个编号为 1 到 的小鼠列表,按年龄递增顺序排列。

是前 只小鼠中雄性的数量。

是前 只小鼠中进行 次匹配的方法数量。

(i 1)。

  1. 时, 是多少?
  2. 假设我们已经在前 只小鼠中进行了 次匹配,且 。匹配第 只小鼠还有多少剩余的方法?
  3. 表示 的公式。