數值方法

advertisement
資料結構
課堂作業八
系級:
座號:
姓名:
一、 是非題(10%)
(
)
1. The seek time is the time taken to position the read/write heads to the
correct cylinder.
(
)
2. The most popular method for sorting on external storage devices is
quick sort.
(
)
3. The latency time is the time to transmit the block of data to/from disk.
(
)
4. A collision occurs when two non-identical identifiers are hashed into the
same bucket.
(
)
5. A hash function transforms an identifier into a bucket address in the
hash table.
二、 填充題(24%)
1.
and chaining are methods which can handle overflows.
2. In a
hash function, a random identifier x has an equal chance of
hashing into any of the b buckets.
3. Let n be the number of identifiers in the table, T be the total number of possible
identifiers, b be the number of buckets, and s be the number of records in each
bucket, then
(1) the identifier density of a hash table is
.
(2) the loading factor of a hash table is
4. Two identifiers, I1 and I2, are said to be
function h if h(I1) = h(I2).
5. Given a binary search tree:
.
with respect to the hashing
if
for
while
else
then
do
(1) the external path length E of the tree is :
.
(2) the internal path length I of the tree is :
.
(3) if the number of external nodes of the binary tree is n, then the related
formula of E and I is
.
三、 (10%) Given a 12-element min-max heap as follows, please show
7
70
40
30
40
9
50
15
10
30
20
12
(1) the min-max heap after inserting two new elements with keys 5 and 80,
respectively. ( the node with key 5 is inserted first)
(2) the min-max heap after deleting two elements from the above 14-element
min-max heap.
四、 (10%) Given an 11-element deap as follows, please show
5
45
10
15
8
19
40
25
9
30
20
(1) the deap after inserting two new elements with keys 4 and 80, respectively.
( the node with key 5 is inserted first)
(2) the deap after deleting two min elements from the above 13-element deap.
五、 (20%) Given two min leftist trees, please show
4
6
7
9
5
11
8
12
80
13
10
20
18
15
(1) the min leftist tree after combining these two trees.
(2) the shortest value of node whose key is 2 after the combining process.
(3) the min leftist tree after inserting two new elements with keys 2 and 90,
respectively. ( the node with key 2 is inserted first)
(4) the min leftist tree after deleting a min element from the 16-element tree.
六、 (16%) Here shows two possible binary search trees for the identifier set (a1, a2,
a3) = (do, if, while)
while
do
if
do
while
if
(a)
(b)
(1) with equal probabilities, pi = qj = 1/7 for all i and j, show the cost (tree a) and
cost (tree b).
(2) with probabilities, p1 = 0.5, p2 = 0.1, p3 = 0.05, q0 = 0.15, q1 = 0.1, q2 = 0.05,
and q3 = 0.05, show the cost (tree a) and cost (tree b).
七、 (10%) If we construct and maintain a height-balanced binary search tree in each
insert operation, and assume the insertions are made in the following order-MAR, MAY, NOV, AUG, APR, JAN, DEC, JUL, FEB, JUN, OCT, SEP. Then
please show the height-balanced binary search trees after inserting the node
“JUL” and “SEP”, respectively.
Download