-->
当前位置:首页 > 题库

单选题:Sorting-by-merging is a classic serial algorithm. It can be tra

Luz5年前 (2021-05-10)题库2239
Sorting-by-merging is a classic serial algorithm. It can be translated directly into a reasonably efficient parallel algorithm. A recursive description follows.

MERGE−SORT( A(1), A(2), ..., A(n); B(1), B(2), ..., B(n) )

Assume that $$n = 2^l$$ for some integer $$l \ge 0$$

if n = 1 then return B(1) := A(1)

else call, in parallel, MERGE−SORT( A(1), ..., A(n/2); C(1), ..., C(n/2) ) and

- MERGE−SORT(A(n/2+1), ..., A(n); C(n/2+1), ..., C(n) )

- Merge (C(1),...C(n/2)) and (C(n/2 + 1),...,C(n)) into (B(1), B(2), ..., B(n)) with time O(n)

Then the MERGE−SORT runs in __ .
@[A](3)

A. $$O(n\log n)$$ work and $$O(\log^2n)$$ time
B. $$O(n\log n)$$ work and $$O(\log n)$$ time
C. $$O(n\log^2 n)$$ work and $$O(\log^2n)$$ time
D. $$O(n\log^2 n)$$ work and $$O(\log n)$$ time




A.$$O(n\log n)$$ work and $$O(\log^2n)$$ time
B.$$O(n\log n)$$ work and $$O(\log n)$$ time
C.$$O(n\log^2 n)$$ work and $$O(\log^2n)$$ time
D.$$O(n\log^2 n)$$ work and $$O(\log n)$$ time


答案:A