数据结构与算法 外部排序

1-1
To merge 55 runs using 3 tapes for a 2-way merge, the original distribution (34, 21) is better than (30, 25). T
1-2
Replacement selection is a method for generating longer runs in external sorting. T
1-3
Polyphase merge is a method for speeding up k-way merge in external sorting. F
1-4
The bottleneck of external sorting is to merge the records from input buffers to the output buffers. F
外部排序的瓶颈是将输入缓冲区的记录合并到输出缓冲区
1-5
In external sorting, a k-way merging is usually used in order to reduce the number of passes and we will take the k as large as possible as long as we have enough amount of tapes. F
1-6
If there are 105 runs to be merged using 4 taps for 3-way merges, then distributing the runs unevenly as (17, 32, 56) will require less number of passes than the even distribution (35, 35, 35). T
1-7
外排序中,给定 1000 个段和 8 条磁带。如果使用简单的 k 路归并,则最少要执行 5 趟(段的生成不算在内)。 T
1-8
The first 9 numbers of 3-order Fibonacci numbers are 0,0,1,1,2,4,7,13,24. T
K阶斐波拉契数列定义:前K-1项为0,第K项为1,从第K+1项起该项为其前面K项的和。
1-9
For the purpose of parallel operations, we need 2k input buffers and 2 output buffers for a k-way merge. T
1-10
Suppose that the internal memory can handle M records at a time, replacement selection can generate a longer run up to a maximun of 2M. F
1-11
In general, for a 3-way merge we need 6 input buffers and 2 output buffers for parallel operations. T
2-1
Given input { 23, 12, 81, 59, 13, 25, 19, 89, 28, 1, 8, 5, 34 }. Suppose that the internal memory can handle M=4 records at a time. Which of the following statements is true? B
A.If simple 3-way merges are used, we would only have to do 1 pass (the initial run generating pass is not included) with 6 tapes.
B.If the polyphase merge is used with Fibonacci splitting to perform 2-way merges, we would have to do 3 passes (the initial run generating pass is not included) with 3 tapes.
C.If the replacement selection is used, the longest run that can be generated contains 6 records.
D.None of the above is true.
2-2
假设我们只有2条磁带T a和T b用于做外部排序。假设内存可以一次处理M条记录。初始状态下T a上存有N条记录。下列简单算法的执行步骤为:第1步:从T a一次读入M条记录到内存,做内部排序,然后将有序的结果写到Tb。第2步:从T a 一次读入M条记录到内存,做内部排序,然后将其与T b上存储的有序列做归并,将有序的(2M条记录)结果写到Ta。第3步:从T a 一次读入M条记录到内存,做内部排序,然后将其与T b上存储的2M条记录的有序列做归并,将有序的(3M条记录)结果写到T b 。重复第2、3步,直到全部记录有序。上述算法需要执行__轮。 C
A.logN
B.log(N/M)
C.N/M
D.logM(N)
2-3
给定13段有序列以及4条磁带用于做外部排序。如果我们应用3路多相归并、以及Fibonacci分割,则必须执行多少轮归并(初始有序段的生成不算在内)? A
A.4
B.5
C.6
D.7

  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值