### 一、Data Structure (50%)

1. (20%) Let $S_n$ be the expected number of comparison in a successful search of a randomly constructed n-node binary tree, and let $U_n$ be the expected number of comparisons in an unsuccessful search. We assume that $H_n$ is the n-th harmonic number. Please represent $S_n$ and $U_n$ respectively using harmonic number.

2. (30%) For the AOE (Activity on Edge) network described by the table, (a) What is the earliest time the project can finish? (b) Please list all critical paths. Note that state 1 is the starting state and state 10 is the goal state.

 Activity From state To state Time $a_1$ 1 2 5 $a_2$ 1 3 5 $a_3$ 2 4 3 $a_4$ 3 4 6 $a_5$ 3 5 3 $a_6$ 4 6 4 $a_7$ 4 7 4 $a_8$ 4 5 3 $a_9$ 5 7 1 $a_{10}$ 5 8 4 $a_{11}$ 6 10 4 $a_{12}$ 7 9 5 $a_{13}$ 8 9 2 $a_{14}$ 9 10 2

(a) 22
(b)
1: $a_2 \rightarrow a_4 \rightarrow a_8 \rightarrow a_{10} \rightarrow a_{13} \rightarrow a_{14}$
2: $a_2 \rightarrow a_5 \rightarrow a_{10} \rightarrow a_{13} \rightarrow a_{14}$

### 二、Algorithms (50%)

1. (20%) Solving the recurrence $T(n) = 2T(n/4) + \sqrt{n}$ using $\Theta$ notation.

2. (20%) The incident matrix of a directed graph $G=(V,E)$ with no self-loops is a $|V| \times |E|$ matrix $B = (b_{ij})$ such that

$$\begin{equation} b_{ij} = \begin{cases} -1 & \text{if edge j leaves vertex i}\\ 1 & \text{if edge j enters vertex i}\\ 0 & \text{otherwise} \end{cases} \end{equation}$$

Describe what the entries of the matrix product $BB^T$ represent, where $B^T$ is the transpose of $B.$

Let $A = BB^T = (a_{ij})$
$$\begin{equation} a_{ij} = \begin{cases} v_i \text{‘s } indeg() + outdeg() & i = j\\ -1 \times \text{edges between } v_i \text{ and } v_j & i \neq j \end{cases} \end{equation}$$

3. (10%) The Fibonacci numbers are defined by recurrence

$F_0 = 0,$
$F_1 = 1,$
$F_i = F_{i-1} + F_{i-2}$ for $i \geq 2.$
Give an $O(n)$-time dynamic-programming algorithm to compute the nth Fibonacci number.

.wp-block-code{border:0;padding:0}.wp-block-code>div{overflow:auto}.shcb-language{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal;word-break:normal}.hljs{box-sizing:border-box}.hljs.shcb-code-table{display:table;width:100%}.hljs.shcb-code-table>.shcb-loc{color:inherit;display:table-row;width:100%}.hljs.shcb-code-table .shcb-loc>span{display:table-cell}.wp-block-code code.hljs:not(.shcb-wrap-lines){white-space:pre}.wp-block-code code.hljs.shcb-wrap-lines{white-space:pre-wrap}.hljs.shcb-line-numbers{border-spacing:0;counter-reset:line}.hljs.shcb-line-numbers>.shcb-loc{counter-increment:line}.hljs.shcb-line-numbers .shcb-loc>span{padding-left:.75em}.hljs.shcb-line-numbers .shcb-loc::before{border-right:1px solid #ddd;content:counter(line);display:table-cell;padding:0 .75em;text-align:right;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:1%}array f[0...n];

f = 0;

f = 1;

for i = 2 to n:

f[i] = f[i - 1] + f[i - 2];

return f[n];Code language: plaintext (plaintext)