1. For a two dimensional array $A$, if the location of $A(4, 3)$ is 1000 and $A(3, 5)$ is 1013. Assume that each element occupies 1 address. What is the location of $A(2, 2)$? (10%)

2. Which of the choices DO NOT contain two equivalent expressions? Note that A^B is $A^B$. (15%)

.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%}(a) Infix    A+B-C            Prefix  -+ABC
(b) Postfix  AB+CD-*          Prefix  *+AB-CD
(c) Postfix  AB^C*D-EF/GH+/+  Prefix  +-*^ABCD//EF+GH
(d) Postfix  AB+C*DE--FG+^    Prefix  ^-*+ABC-DE+FG
(e) None of the aboveCode language: plaintext (plaintext)

3. Read the following data in the given order: (30%)

$$55, 45, 25, 35, 85, 95, 65, 75, 105, 15$$

(a) If you create a max heap for them, what will be the value in root? (10%)
(b) If you create a 2-3 tree for them, what will be the value in root? (10%)
(c) If you create an AVL tree for them, what will be the value in root? (10%)

4. Use the Bellman-Ford algorithm, STEP BY STEP, to find the shortest path and the length from node 0 to node 6 in the following graph. Note that you get 0 point without showing the result after each step. (15%)

$$圖片請看原檔$$

5. Consider the merge sort and quick sort. Let $L_{1}$ and $L_{2}$ be two sorted lists of $m$ and $n$ elements, respectively. (15%)

(a) What is the maximum number of comparisons needed for merging $L_{1}$ and $L_{2}$? (5%)
(b) What is the minimum number of comparisons needed for merging $L_{1}$ and $L_{2}$? (5%)
(c) Both merge sort and quick sort are suitable for external sorting. Right? Explain your answer. (5%)

(a) $m + n – 1$
(b) $min(m, n)$
(c) No, only merge sort is suitable for external sorting.

6. Describe three key points for designing a good hashing function. (15%)

1. Simple and Fast
2. The less collision the better
3. The hash function uniformly distributes the data across the entire set of possible hash values