2019

Question 7

To determine the order of elements (different natural numbers) , we generate a binary tree starting from the root node by repeating the following step:

  • At each node, if the order of all elements has been determined, let the node be a leaf and label it with the order of all elements. Otherwise, select a pair of elements whose order has not yet been determined, and compare them. If , go to the left child node; otherwise, go to the right child node.

We call such a binary tree a decision tree. A decision tree shows how a sorting algorithm compares elements.

Answer the following questions:

  1. When is fixed, among all paths from the root to leaves in all decision trees, describe a shortest path and a longest path.
  2. Prove that in any decision tree, any order of all elements appears in one leaf but does not appear in different leaves.
  3. Let denote the height of a decision tree. Prove for a constant .

为了确定 个元素(不同的自然数) 的顺序,我们通过重复以下步骤生成一棵二叉树:

  • 在每个节点,如果所有元素的顺序已经确定,则让该节点成为叶子并标记为所有元素的顺序。否则,选择一对顺序尚未确定的元素 ,并比较它们。如果 ,则转到左子节点;否则,转到右子节点。

我们将这种二叉树称为决策树。决策树显示了排序算法如何比较元素。

回答以下问题:

  1. 固定时,在所有决策树中从根到叶的所有路径中,描述最短路径和最长路径。
  2. 证明在任何决策树中,所有元素的任何顺序出现在一个叶子中,但不会出现在不同的叶子中。
  3. 表示决策树的高度。证明 对于某个常数

Question 8

If an real symmetric matrix satisfies condition for any non-zero -dimensional real column vector , is called a positive definite matrix ( represents the transpose of ). Answer the following questions.

  1. Show the diagonal elements of real positive definite matrix are positive.
  2. Show the eigenvalues of real symmetric matrix are real.
  3. Show the eigenvalues of positive definite matrix are positive.
  4. Let be the set of non-zero -dimensional real column vectors of unit length. Show is the largest eigenvalue of positive definite matrix .
  5. Suppose the eigenvectors of positive definite matrix are all different. Furthermore, suppose you know the largest eigenvalue and its associated eigenvector . Explain how to compute the second largest eigenvalue using and without computing the third largest or smaller eigenvalues.

如果一个 实对称矩阵 满足对于任意非零 维实列向量 ,有 ,则称 为正定矩阵 ( 表示 的转置)。回答以下问题。

  1. 证明实正定矩阵 的对角元素 是正的。
  2. 证明实对称矩阵 的特征值是实数。
  3. 证明正定矩阵 的特征值是正的。
  4. 为非零 维实列向量 的单位长度集合。证明 是正定矩阵 的最大特征值。
  5. 假设正定矩阵 的特征向量都不相同。此外,假设你知道最大特征值 及其关联的特征向量 。解释如何在不计算第三大或更小的特征值的情况下,使用 计算第二大特征值

Question 9

We wish to sort an array of integers, ( is a natural number) in ascending order. Assume that loading/storing an integer and comparing two integers take unit time.

  1. Let . Show an algorithm that sorts the array, .
  2. Given two sorted arrays, and , show an algorithm that merges the two arrays and calculates the sorted array in time.
  3. Let be the running time for sorting an array, . We sort the first half of the array in time, and sort the second half similarly. Then we obtain the full sorted array by merging the first and second half of the arrays using the algorithm we used in (2). Derive the recurrence for in terms of and , and then derive an explicit formula for .
  4. Notice that in (2), the first half of the sorted array, , contains the first elements of and the first elements of . Given two sorted arrays, and , show an algorithm that finds in time. For simplicity, you may assume that are distinct numbers.
  5. Assume that we have CPU cores, and assume that we can ignore the synchronization cost between CPU cores. Show the running time complexity of a parallel merge sort algorithm that uses the technique in (4).

我们希望按升序排序一个整数数组 ( 是一个自然数)。假设加载/存储一个整数和比较两个整数所需的时间是单位时间。

  1. 。展示一个排序数组 的算法。
  2. 给定两个已排序的数组 ,展示一个算法,将这两个数组合并并计算排序后的数组 ,时间复杂度为
  3. 为排序数组 的运行时间。我们在 时间内对数组的前半部分进行排序,并以类似方式对后半部分进行排序。然后我们通过使用 (2) 中的算法合并数组的前半部分和后半部分来获得完全排序的数组。推导 的递推关系,并得出 的显式公式。
  4. 注意在 (2) 中,排序后的数组的前半部分 包含了 的前 个元素和 的前 个元素。给定两个已排序的数组 ,展示一个在 时间内找到 的算法。为了简单起见,你可以假设 是不同的数字。
  5. 假设我们有 个 CPU 核,并假设可以忽略 CPU 核之间的同步成本。展示使用 (4) 中技术的并行归并排序算法的运行时间复杂度。

Question 10

Answer the following questions regarding undirected graphs. A simple graph is a graph that does not contain any multi-edges or self-loops. A walk is defined as a connected sequence of edges.

  1. Prove that, for any graph , the number of nodes whose degree is odd is always even.
  2. Write the adjacency matrix of the following graph, and show that the number of walks of length 2 between nodes 1 and 4 is equal to the -element of .
  1 -- 2
  | \  |
  |  \ |
  3 -- 4
  1. Prove that, for any simple graph with some adjacency matrix , the number of walks of length between nodes is equal to the element of .
  2. Assume that a simple connected graph has two or more nodes. Prove that has at least two nodes with identical degree.

回答以下关于无向图的问题。简单图是指不包含任何多重边或自环的图。行走被定义为边的连接序列。

  1. 证明对于任何图 ,度数为奇数的节点数总是偶数。
  2. 写出以下图的邻接矩阵 ,并证明节点 1 和 4 之间长度为 2 的路径数等于 元素。
  1 -- 2
  | \  |
  |  \ |
  3 -- 4
  1. 证明对于任何具有某个邻接矩阵 的简单图 ,节点 之间长度为 的路径数等于 元素。
  2. 假设一个简单连通图 有两个或更多节点。证明 至少有两个度数相同的节点。

Question 11

Suppose that a sequence is generated from a first-order stationary Markov model that has initial probabilities and transition probabilities as follows.

Initial probabilities:

Transition probabilities:

Note that is the probability that is true, and is the conditional probability that is true when is true.

Answer the following questions:

  1. Assume . Show the probability that is included as a continuous substring in . Show also the probability that is included as a continuous substring in .
  2. Assume . Show the expected number of 1s in when is included as a continuous substring in .

In the following questions, use the following transition probabilities.

  1. Calculate the expected proportion of 1s in when .
  2. Suppose that ( is a positive integer). When every two letters of is converted to a letter of using the following rule, calculate the expected proportions of in when .

假设序列 是从一个一阶平稳马尔可夫模型生成的,该模型具有如下初始概率 和转移概率

初始概率:

转移概率:

注意 为真的概率, 为真时的条件概率。

回答以下问题:

  1. 假设 。证明在 中包含 作为连续子串的概率。也证明在 中包含 作为连续子串的概率。
  2. 假设 。证明在 中包含 作为连续子串时 中 1 的期望数量。

在以下问题中,使用以下转移概率。

  1. 计算当 中 1 的期望比例。
  2. 假设 ( 是一个正整数)。当 的每两个字母转换为 的一个字母时,使用以下规则,计算 的期望比例,当 时。

Question 12

Let be a sequence of (possibly negative) integers. We wish to find and such that and maximize

As a first step, we calculate

  1. Write a formula for .
  2. Write a formula for in terms of .
  3. Write an algorithm that calculates the following value and outputs a pair satisfying the requirements:

The running time of your algorithm should be . Assume that operations on two integers take unit time: , .


为一个(可能为负数)的整数序列。我们希望找到 使得 并且使

最大化。

第一步,我们计算

  1. 写出 的公式。
  2. 写出 的公式。
  3. 写出一个算法计算以下值并输出满足要求的 对:

算法的运行时间应为 。假设对两个整数的操作需要单位时间:,