17.01.2013 Views

Algorithms and Data Structures for External Memory

Algorithms and Data Structures for External Memory

Algorithms and Data Structures for External Memory

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

54 <strong>External</strong> Sorting <strong>and</strong> Related Problems<br />

example, the blocks <strong>for</strong> the subfiles can be allocated from the blocks<br />

freed up from the file being partitioned; the disadvantage is that the<br />

blocks in the individual subfiles are no longer consecutive on the disk.<br />

The algorithms can be adapted to run on D disks with a speedup<br />

of O(D) using the techniques described in Sections 5.1 <strong>and</strong> 5.2.<br />

5.6 Permuting<br />

Permuting is the special case of sorting in which the key values of the<br />

N data items <strong>for</strong>m a permutation of {1,2,...,N}.<br />

Theorem 5.3 ([345]). The average-case <strong>and</strong> worst-case number<br />

of I/Os required <strong>for</strong> permuting N data items using D disks is<br />

� � ��<br />

N<br />

Θ min , Sort(N) .<br />

D<br />

(5.11)<br />

The I/O bound (5.11) <strong>for</strong> permuting can be realized by one of<br />

the optimal external sorting algorithms except in the extreme case <strong>for</strong><br />

which B logm = o(logn), when it is faster to move the data items one<br />

by one in a nonblocked way. The one-by-one method is trivial if D =1,<br />

but with multiple disks there may be bottlenecks on individual disks;<br />

one solution <strong>for</strong> doing the permuting in O(N/D) I/Os is to apply the<br />

r<strong>and</strong>omized balancing strategies of [345].<br />

An interesting theoretical question is to determine the I/O cost <strong>for</strong><br />

each individual permutation, as a function of some simple characterization<br />

of the permutation, such as number of inversions. We examine<br />

special classes of permutations having to do with matrices, such as<br />

matrix transposition, in Chapter 7.<br />

5.7 Fast Fourier Trans<strong>for</strong>m <strong>and</strong> Permutation Networks<br />

Computing the Fast Fourier Trans<strong>for</strong>m (FFT) in external memory consists<br />

of a series of I/Os that permit each computation implied by the<br />

FFT directed graph (or butterfly) to be done while its arguments are<br />

in internal memory. A permutation network computation consists of an<br />

oblivious (fixed) pattern of I/Os that can realize any of the N! possible

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!