Summary: Lower Bound on External Permuting
Theorem 1 Rearranging N elements according to a given permutation requires (min {N, n logm n})
I/O-operations.
Proof : To prove the theorem we first make a few extra model assumptions:
1. External memory is divided into N tracks of B elements; An I/O moves the elements in a
track to/from main memory.
2. I/Os are simple: Transfer of elements is the only allowed operation; No new elements (or
copies of existing elements) can be produced.
3. Main memory and disk is viewed as one big extended storage array.
The idea in the proof is now to bound the number of permutations we can produce with a given
number of I/Os. A permutation is defined as the layout of elements in the extended storage array,
ignoring empty entries, and the assumptions means that we can identify one unique permutation of
the N elements at any given time of an algorithm. Initially we have one permutation (the original
layout of the elements) and we want to be able to produce N! permutations.
Consider an input operation. We can choose between N track to input. After loading one such track
we can rearrange the B elements in the track and place these elements between the M - B
elements in memory. Thus we produce at most N · B! · M
B new permutations. If the loaded track
has been touched previously we do not get the B! term. The number of times we can read such a
"fresh" track is at most N